Report parameters

Martin Obongita martin.obongita at yahoo.com
Tue Jan 11 17:46:25 UTC 2022


 Hi Kelly,        
I have not fully understood how to format messages in this comments section.    So I try to separate the sentences with ' */ '    I appreciate your help and the print method snippet.        
You mentioned that:    "    Then in the $print method of the detail section, you can test whether to include those lines -

$print
---------
If iIncludeDetails
    Do default
End if"    Are you referring to the $print method of the detailed section in the report class?    I don't seem to know where to place this method.    The other question is how to format the report class based upon the sort fields such as field names, descending, upper case, subtotals and new page.    I wish to sort the report sort fields programmatically.        
Kind regards,    Martin O.    



    On Tuesday, January 11, 2022, 04:16:57 PM GMT+3, Kelly Burgess <kellyb at montana.com> wrote:  
 
 Hi Martin,

Your message is oddly formatted and seems to end abruptly, so I hope I'm reading it right ..

    https://lists.omnis-dev.com/pipermail/omnisdev-en/2022-January/047222.html

>How do I implement these parameters in my print method?

One way would be to collect the user input for copies, etc. and just pass things as parameters to the report $construct...

    Set report name rRecordList
    Print report (iReportTitle,iDataList,iTableClassname,iIncludeDetails,iNumCopies,iBkgdImage)

Then in the report $construct you could copy all the parameters into instance variables first, and print the report from there...

$construct
-----------------
If $cdevice().$name='Printer'
    Do $cinst.$openjobsetup()
End If
#
# get parameters into instance variables
Calculate iTitle as pReportTitle
Calculate iDataList as pDataList
Calculate iTableClassname as pTableClassname
Calculate iIncludeDetails as pIncludeDetails
Calculate iNumCopies as pNumCopies
Calculate iBkgdImage as pBkgdImage
#
# set things up
Do $cinst.$copies.$assign(iNumCopies)  ## or maybe you need to assign $root.$prefs.$copies before the report instantiates?
Do $cinst.$backpicture.$assign(iBkgdImage)
# .. etc. for your title and tableClassname parameters ..
#
# print the report
For iDataList.$line from 1 to iDataList.$linecount
    Do $cinst.$printrecord()
End For
Do $cinst.$printtotals()
Do $cinst.$endprint()

-------------------

Then in the $print method of the detail section, you can test whether to include those lines -

$print
---------
If iIncludeDetails
    Do default
End if

and that would suppress whatever section you put it in when the test is false.  You can use positioning sections this way to include/suppress single lines within a detail section.

But I'm not sure if number of copies is useful when printing to PDF because there's no mechanism for supplying a second, third etc. PDF filename.

Hope it helps,

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