baanryanm
16th May 2002, 21:01
We print a daily report from Baan everyday via a Baan Job. The output is an ASCII file using the ascif device. The name of the file is "totals.txt". Soon after the batch finishes, we run a windows batch file to rename the file from totals.txt to totals_%today's date%.txt (ex. totals_05162002.txt). This allows us to keep a history of the report.
I would like to eliminate the need for the windows batch file. Is there a way to create the report name using a date variable directly at the Device screen (or some other way in Baan)?
NPRao
16th May 2002, 23:24
You can code it as -
fname = fname & sprintf$("%u(%04Y%02m%02d)", utc.num())
You will get the file name appended by todays date in the format as -
fname20020516
baanryanm
18th May 2002, 00:04
I'm sorry, but I don't follow you.
I don't really want t code it. I want to type something into the Device print output screen.
NPRao
18th May 2002, 00:15
If you go into the maintain device data details session,
check the field called - change output file allowed.
then when you use ur reports and try to redirect to a file/word..etc you will be able to edit the file name manually.
But to get the data stamping automatically into your reports, I think its possible only with coding [which is not a big code], you can use the spool functions... like -
spool.fileout = fname & sprintf$("%u(%04Y%02m%02d)", utc.num())
you have to write a 3-GL script and use the argv(1) to get the temporary report output file, copy it and assign a new name to it.
arunkw
26th August 2002, 12:15
Hi All,
I tried the above given code in my report script (baanIV) but i got error during compilation
as "Error: Unresolved reference to function 'utc.num'."
actually i shouldn't be getting this error at first place as this is a baan standard function given by been itself is their any include etc that has to be mention.
I can use date$ but then it won't work with the above code of sprintf$
arunkw
26th August 2002, 12:43
but instead of function utc.num(), if i use date.num() it works
ie string temp(50)
temp = sprintf(%D(%04Y%02m%02d)date.num())