Report parameters

Kelly Burgess kellyb at
Fri Jan 14 08:33:17 UTC 2022

Hi Martin,

Maybe something like this in the report $construct -

Calculate iDataList as pDataList  ## use a copy of the list
If pSortCol='code'
	Do iDataList.$cols.$add('sortCol',kCharacter,kSimplechar)
	Do iDataList.$sendall($ref.sortCol.$assign($sendallref.code))
Else If pSortCol ='childCode'
	Do iDataList.$cols.$add('sortCol',kInteger,k32bitint)
	Do iDataList.$sendall($ref.sortCol.$assign($sendallref.childCode))
Else If pSortCol ='parentCode'
	Do iDataList.$cols.$add('sortCol',kInteger,k32bitint)
	Do iDataList.$sendall($ref.sortCol.$assign($sendallref.parentCode))
End If
Do iDataList.$sort($ref.sortCol,kFalse)  ## or do more specific sub-sorting per case after each $sendall

. . followed by your print loop . . .
For iDataList.$line from 1 to iDataList.$linecount
	Do $cinst.$printrecord()
End for
Do $cinst.$printtotals()
Do $cinst.$endprint()

Then you could put iDataList.sortCol into $sorts.1 at design time and set its subtotal flag.

You could also copy pSortCol (other parameters too) to an instance variable and use it to turn content on or off, when you want to do different things in subtotal sections depending on the sort type.

When I've built multi-behavior reports I've tended to add column(s) of non-printing metadata to the list for the report to use in $print method decisions, $nolineifempty field calculations, etc.


More information about the omnisdev-en mailing list