chris_kzn
11th February 2015, 13:28
Does anyone know if there is anything you can do to split the output of a report object into two separate files?

Here is the problem: I have one report that uses two different report layouts, the one is a customer copy, the other is an internal department copy.

I am using the B2Diz (from NAZDAQ) software on this report and we use a different letterhead for page 1 and page 2 (or any pages after page 2).

The two documents are printed on the same report so if the document is a 4 page in total document, then the first two pages come out 100% but the consecutive ones do not come out correctly.

I would like to still allow the user to only have to run the report once but am unsure if it is possible to create two separate reports, and then have the first report call the second report in order for two (first pages: Customer and Internal) to print correctly using the B2Diz software.

In my mind, it is sort of splitting the report object into two - does anyone know if there is any method for this to be done within BaaN IVc4?

bhushanchanda
11th February 2015, 14:31
Hi,

Offcourse you can slip a report into 2 reports. You can use brp.* functions to open another report in one report layout. But about the integration with B2Diz, I guess George (http://www.baanboard.com/baanboard/member.php?u=6453) can provide you a better solution if he notices this thread.

chris_kzn
11th February 2015, 14:56
@bhushanchanda, if the main report is rtdsls440301000 and the second report is rtdsls440301001, using the brp.* function, I would like this to use the same device as what the user originally selected, what would the required code be in order to get this to function or work correctly? I am not advanced with 3GL or 4GL, thanking you in advance.

bhushanchanda
11th February 2015, 15:03
Hi,

You can use predefined variable spool.device when opening the report. It will use the same device which was provided by the user.

id = brp.open("rtdsls440301001",spool.device,0)

You can use this piece of code to open the report. And use brp.ready(id) to send data to the report. You need to study the report script sections programming to do it.

You can check the following threads for reference -

Thread 1 (http://www.baanboard.com/baanboard/showthread.php?t=23059)
Thread 2 (http://www.baanboard.com/baanboard/showthread.php?t=65441)
Thread 3 (http://www.baanboard.com/baanboard/showthread.php?t=12284)
Thread 4 (http://www.baanboard.com/baanboard/showthread.php?t=25044)
Thread 5 (http://www.baanboard.com/baanboard/showthread.php?t=9693)

george7a
11th February 2015, 15:26
The current version of b2Diz cannot handle two reports in one. You need to send each report, alone, to the device. And then b2Diz can apply the setting to each report alone.

You also can request a customization, then we can tweak the product to meet this specific request.

chris_kzn
11th February 2015, 15:56
Perfect, thank you, I can see the one post recommended from 2003 is the most informative on e which is what I am looking for.

@george7a, who must I email my list of update requests to?

george7a
11th February 2015, 17:12
Chris,

I am sorry if I was not clear. What you need is not support with b2Win. There are no updates here.

If you like NAZDAQ can give you a quote to add this special requirement in the product. You can contact Ehab for a quote.

chris_kzn
12th February 2015, 09:18
ok, when I add the following snippet to the report code declaration section, I get a compile error.
choice.cont.process:
on.choice:
rpt1 = brp.open("rtdsls440301000", spool.device, 2)
rpt2 = brp.open("rtdsls440301001", spool.device, 0)

It states label 'choice.cont.process' not expected within section
label 'on.choice' not expected within section
No statements expected outside section
label 'after.choice' not expected outside section

Do I have declare anything for rpt1 and rpt2?

george7a
12th February 2015, 09:20
It seems you have added it in the wrong section. Can you attach the whole script?

bhushanchanda
12th February 2015, 09:22
ok, when I add the following snippet to the report code declaration section, I get a compile error.
choice.cont.process:
on.choice:
rpt1 = brp.open("rtdsls440301000", spool.device, 2)
rpt2 = brp.open("rtdsls440301001", spool.device, 0)

It states label 'choice.cont.process' not expected within section
label 'on.choice' not expected within section
No statements expected outside section
label 'after.choice' not expected outside section

Do I have declare anything for rpt1 and rpt2?

Hi Chris,

choice.cont.process: is not a part of report script.

Also, you don't need to open both the reports as one of the report will be opened by the session itself.

In report script, you can do this:-

declaration:
long rpt2

before.program:
rpt2 = brp.open("rtdsls440301001", spool.device, 0)

chris_kzn
12th February 2015, 11:22
Thank you Bhushan, this now seems to open the report but does not seem to get printed or closed but now that I am typing this, I know how to get it to close but how do I get it to actually print then. Is there another leg? I have even tried changing the spool.device to 2, to allow the user to reselect another device but this has no effect.

bhushanchanda
12th February 2015, 11:39
Hi,

If you want to start printing the data after report 1 is completely printed, then you need to use a select statement in your after.report: section and use brp.ready() to send the data. You dont need to use another device. You can use spool.device and mode as 0.

chris_kzn
12th February 2015, 12:04
I posted the report script as per your original request, when I attempt to add the following, the compiler tells me that I have the field defined but never used:
Warning: Section 'after.report.1' defined but never used.

My snippet of code:
after.report.1:
after.layout:
layout.again()
brp.ready()
|* brp.close(rpt2)

bhushanchanda
12th February 2015, 14:32
Hi,

It will not work like that. I guess what you are looking is still unclear to me.

As you said, your session has 2 reports attached. So, how do the users print them in one run? Now, the second thing is, when you want to print both reports in one run, once the first report runs completely, you need to program the logic to print the second report in your report script.

e.g. Suppose I have a session tcibd0104m009 which has 2 reports
rtcibd001m9001
rtcibd001m9002

If my 1st report prints data from tcibd001 and once that is printed I have to print my second report which prints data from tccom100

In that case,

after.program/before.program:
| ***Here I will need to add a logic to print my second report
select tccom100.*
from tccom100
where..
selectdo
brp.ready(report_id_for_report_2)
endselect
brp.close()
|*****************************************

chris_kzn
13th February 2015, 11:00
ok, in my instance, both reports are getting the information from the same table, the only difference is that the first report will contain the information for the customer and the second report will be for internal use (prints exactly the same information as the first report - just has different titles). When using B2Diz / B2Win, if the layout s are different, it prints 4 pages (has only 1 page - the first page is different to the second and consecutive pages). I actually need two (first pages) and 2 second pages for this report.

bhushanchanda
13th February 2015, 11:33
Hi,

Ok. So, if just the titles are different. What you can do is -

Say in your first report you have following layouts -

Header 1
Detail 1
Detail 2

Now, in the report script write this -

header.1:
before.layout:
brp.ready(id_of_report2)

detail.1:
before.layout:
brp.ready(id_of_report2)

detail.2:
before.layout:
brp.ready(id_of_report2)

Also, I will suggest create an extra layout after.report for your first report. And for that section write the following code-

after.report:
before.layout:
brp.close(id_of_report2)

or try if it works in

after.program:
brp.close(id_of_report2)

This will send data to your second report and your current report as well.

Again, I am assuming, both the reports have similar layouts and fields. Just the different is the Report Title. And also make sure, you change the report name for the second report to some field and assign that field the name of the second report. Else, it will take name of the first report if you are using predefined/special field on the layout as we are using script of first report to open the second report.

chris_kzn
16th February 2015, 11:19
Thank you, I have tried performing it the first method but something is still not right, it seems to open the report in the background but never gets printed out and does not close. I can see it when I run "ps aux", but it is just showing open there, nothing actually printing out. I have tried using both B2Win device as well as D (Display) for the device.

bhushanchanda
16th February 2015, 11:36
Hi,

Please debug your report and check whether anything is sent to the report or not. Then check whether report 2 is getting closed or not. May be no data is selected to send.