FindGroupChange method (DataWindows)
Description
Searches for the next break for the specified group. A group
break occurs when the value in the column for the group changes. FindGroupChange reports
the row that begins the next section.
Controls
|
DataWindow type |
Method applies to |
|---|---|
|
PowerBuilder |
DataWindow control, DataStore object |
|
Web |
Server component |
|
Web ActiveX |
DataWindow control |
Syntax
[PowerBuilder]
|
1 |
long <span>dwcontrol</span><span>.</span><span>FindGroupChange </span>( long <span>row</span>, integer <span>level</span> ) |
[Web DataWindow server component]
|
1 |
long <span>dwcontrol</span>.<span>FindGroupChange</span> ( long <span>row</span>, short <span>level</span> ) |
[Web ActiveX]
|
1 |
number <span>dwcontrol</span>FindGroupChange ( number <span>row</span>, number <span>level</span> ) |
|
Argument |
Description |
|---|---|
|
dwcontrol |
A reference to a DataWindow control or |
|
row |
A value identifying the row at which |
|
level |
The number of the group for which you |
Return Values
Returns the number of the row whose group column has a new
value, meaning that it begins a new group. Returns 0 if the value
in the group column did not change and a negative number if an error
occurs.
If any argument’s value is null, in PowerBuilder
and JavaScript the method returns null.
The return value observes these rules based on the value of row.
If the starting row is:
-
The
first row in a group, then FindGroupChange returns
the starting row number -
A row within a group, other than the last group,
then FindGroupChange returns the row number of
the first row of the next group -
A row in the last group, other than the first row
of the last group, then FindGroupChange returns
0
Usage
If the starting row begins a new section at the specified
level, then that row is the one returned. To continue searching
for subsequent breaks, increment the starting row so that the search
resumes with the second row in the group.
Examples
This statement searches for the first break in group
2 in dw_regions. The search begins in row 5:
|
1 |
dw_regions.<span>FindGroupChange</span>(5, 2) |
This code finds the number of the row at which a
break occurs in group 1. It then checks whether the department number
is 121. The search begins at row 0:
|
1 |
boolean lb_found |
|
1 |
long ll_breakrow |
|
1 |
|
1 |
lb_found = false |
|
1 |
ll_breakrow = 0 |
|
1 |
|
1 |
DO WHILE NOT (lb_found) |
|
1 |
ll_breakrow = dw_1.<span>FindGroupChange</span>(ll_breakrow, 1) |
|
1 |
|
1 |
// If no breaks are found, exit. |
|
1 |
IF ll_breakrow <= 0 THEN EXIT |
|
1 |
|
1 |
// Have we found the section for Dept 121? |
|
1 |
IF dw_1.GetItemNumber(ll_breakrow, & |
|
1 |
"dept_id") = 121 THEN |
|
1 |
lb_found = true |
|
1 |
END IF |
|
1 |
|
1 |
// Increment starting row to find next break |
|
1 |
ll_breakrow = ll_breakrow + 1 |
|
1 |
LOOP |
|
1 |
|
1 |
IF lb_found = false THEN |
|
1 |
MessageBox( & |
|
1 |
"Not Found", & |
|
1 |
"The Department was not found.") |
|
1 |
ELSE |
|
1 |
... // Processing for Dept 121 |
|
1 |
END IF |