a.menon
12th February 2014, 06:41
Hello everyone,
Requirement :
- Print 5 copies of a customized report
- For each copy give a different header/ title
copy 1 - ABC , copy 2 - DEF and so on...
Constraints :
- No access to Program script
Possible solutions and questions :
- We can specify the copies to be printed during the Device selection
but, how to know the current copy number in the report ?
Like we get the page number in our report as a special field , is there a way to get the copy number ?
- I found in one of the baanboard threads an idea which said call the main session via AFS from the report script, and set spool.nr.copies = n ( no of copies needed)
But, even in this case how can I get the current copy number being printed ?
Please give your suggestions asap. Thanks in advance.:)
bhushanchanda
12th February 2014, 07:39
Hi,
Can't you define different layouts and add conditions?
May be there is a better solution. Will need to try it out.
a.menon
12th February 2014, 08:07
Hi,
Can't you define different layouts and add conditions?
May be there is a better solution. Will need to try it out.
Hi ,
You mean to say make a copy of the layout one with ABC title and another with DEF title etc right?
Even if I am adding different layouts and adding conditions , the condition will be : for copy1 print layout 1 , copy 2 layout 2 etc...
Here also I will need to know the current copy number being printed .
Getting the copy number is the issue here I think .. Or is there a better way ?
bhushanchanda
12th February 2014, 09:45
Hi,
One more way is, create 5 reports having 5 different headings
e.g. Copy-1,Copy-2,Copy-3,Copy-4,Copy-5
Now, in the report script for the first report, in its last layout field in its after.layout section you can write an AFS to call the same session 5 times with same input fields but with different report codes.
It works just fine. The only issue will be it will be completely hard-coded.
a.menon
12th February 2014, 10:14
Hi,
One more way is, create 5 reports having 5 different headings
e.g. Copy-1,Copy-2,Copy-3,Copy-4,Copy-5
Now, in the report script for the first report, in its last layout field in its after.layout section you can write an AFS to call the same session 5 times with same input fields but with different report codes.
It works just fine. The only issue will be it will be completely hard-coded.
That is a good idea , lemme try this out. Thanks !!!
mark_h
12th February 2014, 23:26
Another way to do this and not impact the original session or the users- at least in 4c4 this works. Create a new session - attach the forms from original session and the scripts. You do not need to change anything. Copy the report across - then clone it 4 more times to different numbers. Then each of the 5 reports change the title. Then once again create a new session - you can use the form from the first session. Then you create a new script. When the user clicks continue, you ask for a printer - it now runs the same AFS code 5 times calling for each of the reports in the cloned session. With this you leave the original baan session alone. You can then dork with the AFS and cloned report sessions all you want - never impacting the session the users use.
I have used things like this for some automation processes. In some cases we might run multiple sessions with different inputs and the reports go to different printers. For one process I created a table to track a couple of things. Basically it is session, keyvalue1, keyvalue2, keyvalue3. So I call a routine it looks up the keyvalue - lets say warehouse - it returns keyvalue2 and keyvalue3. Keyvalue2 might contain the printer for the outbound reports and keyvalue3 might be a printer for picktags. It all depends what we want. The use of this table keeps expanding - in some cases we use it for permission on a button on a session, or which default value for a printer will appear in the spool.device session. We use it a lot around AFS sessions.
vamsi_gujjula
13th February 2014, 12:38
Till some extent i agree with Mark...
but another way of doing it is just calling a report with a report script can be done
i have done that once... i will check if i have the script
iscons
14th February 2014, 23:19
Requirement :
- Print 5 copies of a customized report
- For each copy give a different header/ title
copy 1 - ABC , copy 2 - DEF and so on...
run the report in debug and in the debugger list all the variables, there is prob a variable that holds the current copy number. Use this variable in the appropriate before section and set the title, again a variable will be storing the tittle. You can do this in the report script.
rrocks23
21st February 2014, 07:50
U can use spool.pr.copies :)
mark_h
21st February 2014, 16:03
The original issue was they wanted to print the same report 5 times with different headers each time. So spool.pr.copies will always be 5 - so they could not use it to determine which set of headers to print.
rrocks23
22nd February 2014, 08:50
Depending upon this variable you can dynamically change the layout content ...;)
a.menon
25th February 2014, 14:29
Thanks everyone for all your suggestions.
The only solution that seemed feasible is creating an AFS session as mark suggested ,then copying the report five times with different headers and calling same AFS script with different report codes .
Anyway as this required time and effort and as this was an urgent requirement for the client they have agreed for the creation of 5 different reports, each linked to the same session with the same data but just different headers. And yes the classic way they will print each of them.!!
:rolleyes: Yes I know this is not a very pleasing option, but since the user prints the report only once or twice a month , they are ok with this. :D
So this case is closed everyone. Thanks again for all the help!!