Neal Matthews
15th February 2005, 14:50
Hello,
I need to print the same report twice with slightly different parameters. I am attempting to do this using the spool commands in the after.program section of the report script where I call a copy of the report.
The second version of the report is running but the data my report picks up is not correct which is possibly due to the fact that I am calling the report from the after.program scetion of the report script.
Is what I am trying to do actually possible from within a report script or do I need a development licence ?
Cheers
Neal Matthews
IT Support Analyst
ATY Automotive & Industial Components (UK) Ltd.
mark_h
15th February 2005, 15:54
One post (http://www.baanboard.com/baanboard/showthread.php?t=9777&highlight=%22print+report%22) that has more information in it. I guess I do not understand what you are requesting: (1) The same data twice with maybe a different format? (2) new data and the same format? Do you have the session source to modify?
Mark
Neal Matthews
15th February 2005, 16:09
Hello Mark,
I am after the same report but fed with different data and I do not have the source to modify.
This unusual request is due to the fact that I have a report which I can't get to sort by contract analysis code. I want the user to enter a range and I know that there will only be a few analsyis codes in this range. Therefore the plan is to run the report for each analysis code.
I have yet again tried out the sort hack unsuccessfully.
http://www.baanboard.com/baanboard/showthread.php?t=1908&highlight=sort+report
Cheers
Neal
mark_h
15th February 2005, 16:49
One solution I used early on was to clone a session. In effect what I did was copy the form for a session to a new session. This new session then called the actual report using stpapi commands for each purchase order. It seems you mentioned in another post you want to stay away from this.
What is wrong with the hack? Could you post your code?
Mark
Neal Matthews
17th February 2005, 13:06
Hi Mark,
Sorry for the delay here's my version of the hack. Tried looking at it in the debugger but my tmp file had zero bytes in it. I suspect I must be looking at it at the wrong time. At what point should it have data in it ?
Since starting this post I have thought of another issue in that I am attempting to sort on a text field. Will this sort on the text number or the contents of the text.
As I only have to run the report six times for the six analysis codes I will probably have to give up on the range and just run the report six times within E mail job.
Cheers
Neal
after.receive.data:
if(first=0) then
r.o = seq.open (r.datafile$ & ".tmp","w")
r.reccount = 0
while e = 0
l = seq.puts(concat$("",
tdinv100.txta,
tdinv700.item,
tdinv700.cntr,
tdinv700.trdt,
tdinv700.trtm,
m_anal,
sign,
tcmcs072.dsca,
tdinv700.cprj,
tdinv700.logn,
tdinv700.stoc,
tiitm001.copr,
tiitm001.cplb,
tiitm001.seab,
tiitm001.seak,
tiitm001.suno,
trdt.f,
trdt.t,
rlcd.nama,
tdinv700.cwar,
tdinv700.koor,
tdinv700.kost,
tdinv700.orno,
tdinv700.pono,
tdinv700.prst,
tdinv700.quan,
tdinv700.rlcd,
tdinv700.sern,
tiitm001.dsca,r.reccount),r.o)
r.reccount = r.reccount + 1
r.read.seq.file()
endwhile
l = seq.flush (r.o)
l = seq.close (r.lfn)
l = seq.close (r.o)
l = run.baan.prog( "sort","-t +0n -1 +1n -2 " & r.datafile$ & ".tmp -o " & r.datafile$ & ".tmp", RP_WAIT)
r.lfn = seq.open (r.datafile$ & ".tmp" ,"a+")
r.read.seq.file()
first = 1
endif
mark_h
17th February 2005, 16:59
In this case it would sort on the text number. You should be able to look at the ".tmp" file as soons as the seq.close(r.o) takes place. This looks like it should work from first glance.
Mark
Neal Matthews
17th February 2005, 18:53
The tmp file contains 0 in all the lines as the first character where I would expect to see a text number.
Anyway the fact that I'm storing the Analysis Codes in the text means that I probably wouldn't be able to sort on this anyway so i'm afraid it's time to cut my losses with this one again.
Thanks for all your help.
Cheers
Neal