Report parameters

Kelly Burgess kellyb at montana.com
Tue Jan 11 13:16:57 UTC 2022


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


More information about the omnisdev-en mailing list