You do a getItemNumber( <row>, <computed column> ) where:
<row> is one row (usually the first row) in that group, and <computed
column> is your column.
So, if rows 1-10 are in the first group, then getItemNumber( n,
'myCompCol' ) will work for any value of "n" between 1 and 10. You can use
FindGroupChange() to find the first row of the "next" group.
Paul Horan[TeamSybase]
Thank you
"Paul Horan[TeamSybase]" <paul....@teamsybase.net> escribió en el mensaje
news:448f33d6$1@forums-2-dub...
You really can't refer to groups directly within the
datawindow like you can in script. You can't even refer to
previous, next.. computed fields only columns. You will
have to do some coding.
In the datawindow using [] notation you can get the
previous, current value and the next row's value. But you
can only get the previous, current, next for COLUMNS not
computed fields. So you will have to create dummy fields in
the sql and scroll through the datawindow setting the
dummyfields to the computed fields. Then issue a groupcalc
to reset everything and then the datawindow will recalculate
the values.
in the datawindow you must create dummy fields because []
notation can not be used with computed fields:
Select .... 0 as dummy1, 0 as dummy2
This is an example of a computed field in a trailer:
'this: ' +dummy1 [0] + ' next: ' + if (isnull(dummy1
[1]),0,dummy1[1])
it will print out the current dummy1 ([0]) and the next
dummy1 [1]. Note this will be set to the value of the
computed fields using powerscript.
Note: if it is the last row (isnull) then it will display 0
for the value
In script you can scroll thru the datawindow and set the
dummyfields:
long ll_cnt, ll_max, ll_group, ll_value1, ll_value2
long ll_first, ll_last
ll_max = dw_1.rowcount()
for ll_cnt = 1 to ll_max
//get the first row in the group
ll_first = long(dw_1.Describe("evaluate('first( getrow()
for group 1 )',"+string(ll_cnt)+")") )
//get the last row in the group
ll_last = long(dw_1.Describe("evaluate('last( getrow()
for group 1 )',"+string(ll_cnt)+")"))
//header computed fields are in the last row of the group
ll_value1 = dw_1.object.compute_1[ll_first]
//trailer computed fields are in the last row of the group
ll_value2 = dw_1.object.compute_2[ll_last]
if ll_cnt = ll_first then
ll_group = ll_group + 1
//first row processing
end if
if ll_cnt = ll_last then
//last row processing
end if
//set the dummy values in every row to the computed field
values in the 1st..last
dw_1.setitem(ll_cnt, 'dummy1', ll_value1)
dw_1.setitem(ll_cnt, 'dummy2', ll_value2)
next
//now recalculate the datawindow
dw_1.groupcalc()
--
Paul Horan[TeamSybase]
Cynergy Systems
www.cynergysystems.com
<Dawn T Brown Eyes[TeamSybase]> wrote in message
news:448f474a.49...@sybase.com...
I think he was asking for both. ;-)
<Dawn T Brown Eyes[TeamSybase]> escribió en el mensaje
news:4490428d.30...@sybase.com...