Printing reports that depend on entries in form

Hi,

i want print some reports. if the user selects maybe a “1” in a Form report 1 should be printed and if the user selects a “2” another report should be printed. Can anybody tell me whates the best place to insert this behavour? In Code? Or in the Form? Or somewhere else???

Nico

Hi Nico,

This is easy to do - you can use REPORT.RUN or REPORT.RUNMODAL possibly in a CASE statement.

You can code this in the button to run the report.

Well, right now i use the REPORT.RUNMODAL function, but i can not find out in some of the parameter, how to change the used report. i want that in a special case report one is used an in another case report 2. is there a parameter for RUNMODEL where i can give him the report he should use for printing???

Hi Nico,

Have a look at the C/Side reference guide (under the help menu) for report.runmodal

REPORT.RUNMODAL(Number [, ReqWindow] [, SystemPrinter] [, Record])

The number is the number of the report to run

ReqWindow is a boolean to show the request window

SystemPrinter is a boolean to show send the report to the default printer

Record is a variable of type record for the dataitem of the report. (This can be filtered to show a subset of the data)

Thanks Dave. Your answer was very helpfull. Many information at once. Haven’t known that there is a C/Side reference guide. Thank you. But there are further questions. If the user clicks the “Print”-Button, i want that two different reports are printed. i thought its ok to run the RUNMODEL function twice. but is there a better way? it would be nice if the user could see both reports in the preview at once. and after he has seen both reports in the preview, if he clicks on the real “print”-button, both reports should be come out of the selected printer… is that possible with RUNMODAL?

Hi Nico,

Another good source is the application developer guide on the Nav CD/DVD in the doc directory (w1w1adg.pdf).

You could use report.run twice as the runmodal is design to wait until the user is finished. Overall you will still get two previews and two prints. If it makes sense then you can merge the two reports. i.e. it is ok to have two (or more ) root dataitems.

well, i think to see both in one preview would be the best solution, but i can imagine that this is also the hardest to develop, right? Is it easy to merge two reports??? I have a merge tool with that i merge sometimes txt-files…