PowerBuilder does not sort the data when it creates a group. Therefore, if the data source is not sorted, you must sort the data by the same columns (or expressions) specified for the groups.
For example, if you are grouping by dept_id then status, select Rows>Sort from the menu bar and specify dept_id and then status as sorting columns:
You can also sort on additional rows. For example, if you want to sort by employee ID within each group, specify emp_id as the third sorting column.
For more information about sorting, see “Sorting rows”.