Report parameters

Martin Obongita martin.obongita at yahoo.com
Fri Jan 14 06:17:41 UTC 2022


 Hi Kelly,

The issue with sorting the report at the construct of the report class is that the instance variables(iReportSortByParent,iReportSortByChild,iReportPerPage) have not yet been set at this point. The values are empty.
I have therefore inserted the code after the $construct method (where the variables are calculated from parameters) and before the $printrecord command.
If iReportSortByParent
Do $clib.$reports.rRecordListSorted.$sorts.1.$dataname.$assign(iParentColname)

Do $clib.$reports.rRecordListSorted.$sorts.1.$subtotals.$assign(kTrue)

#Do default

End If

If iReportSortByRecord

Do $clib.$reports.rRecordListSorted.$sorts.2.$dataname.$assign(iCode)

Do $clib.$reports.rRecordListSorted.$sorts.2.$subtotals.$assign(kTrue)

If iReportPerPage

Do $clib.$reports.rRecordListSorted.$sorts.2.$newpage.$assign(kTrue)

End If

#Do default

End If

The report now has the record sorted, BUT it is sorted with only the first record in the list.
Please note that I'm using a report superclass to inherit the methods.
Kind regards, Martin O.



    On Friday, January 14, 2022, 12:23:25 AM GMT+3, Kelly Burgess <kellyb at montana.com> wrote:  
 
 Hi Martin,

>I have added the code below to the method $print
> ... 
>If I print, the report does not sort the records as desired.

Right, as the docs I quoted earlier say about $sorts: 
"You can modify the contents of this group at runtime using the notation, to change the sort fields for the report, but if you want the changes to take effect this must be done in the $construct() method of the report before the report instance is created."

So this is something you can't do at section $print time, too late by then.

Kelly
_____________________________________________________________
Manage your list subscriptions at http://lists.omnis-dev.com
Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 
  


More information about the omnisdev-en mailing list