schreddermaus
25th March 2015, 12:29
Hi guys,

is it possible to redirect data from report 1 to report 2 and suppress report 1 (directly in the reportscript)?

Background:
A customer wants different report layouts for different company numbers (e.g. purchase order for comp. 100 should have another look than purchase order for comp. 200), BUT he doesn't wanna select from a list of different reports.

So my idea was to check the company number and select the correct reportcode via script, redirect all data to the new report and close the old report without printing it.

Because I have to do so for Purchase Orders, Order Acknowledgements, Invoices an many more, I would like to do the selection within the standard reportscript instead of searching the right place in the printing session script (too many DLLs behind it ... -.-).

Does someone know if this could work and how I could do that?

bhushanchanda
25th March 2015, 12:47
Hi,

You can copy the report to your Customized VRC and make the changes to it. It will always call the report in your customized VRC and not the standard one.

If that serves your purpose then go for it. Else, there are ways to send data to other report and suppress the existing one. You need to open the new report in before.program section to current report using brp.open() and then use brp.* functions to send data to new report. Once the report is completed printing, you can kill the current report using kill(pid) where pid is the process id of the current report in after.program or after.report

long inf(PSMAXSIZE)
string prog_name(25)

pstat(pid,progname,inf)
if trim$(prog_name) = "current_report_code" then | e.g. rtdsls440110001
kill(pid)
endif

schreddermaus
25th March 2015, 12:58
Hi,

thanks for your reply.

The report is already in the customized VRC and there have to be some other Report variants in the same cust VRC.

Do I have to send the data layout by layout or may I use brp.ready() once at the beginning of the report?

bhushanchanda
25th March 2015, 13:01
Hi,

Yes. The best way to send data is layout by layout as the program script sends the data that way and there is no way to get all the data in one take through report script.

vamsi_gujjula
25th March 2015, 14:13
Rather .. i would prefer this section

after.receive.data:

Or you can have a dummy detail layout(with layout line 0 ) just to send data to other report

schreddermaus
25th March 2015, 14:14
hm, would a detail layout with condition=1 get all data for the current dataset/position?

I think I will try if this would work or if I have to send data from every after- and before-field-layout.

OmeLuuk
6th May 2015, 12:10
From the past I know it is possible to open another report and redirect the input stream from the current report into that other report. Have done that once, it was in an in-dept programming course of former Profuse (NL). - but now I need it myself, I forgot... (memory wearing out, growing old).