macoxy
17th September 2004, 11:37
I have report with script wich i send to device with her own script,program
how to export one variable from report script to device script,program??
report script:
domain tcmcs.str3 jezik
export("jezik",jezik)
device script
extern domain tcmcs.str3 jezik
import("jezik",jezik)
this does not work
mr_suleyman
17th September 2004, 12:55
Do you mean that from session script to report script ? what do you mean that device script ? give more details
macoxy
17th September 2004, 13:01
i have created a baan device with my own 4glprogram to redirect the report to lotus notes. Now i need to export one variable from report script, to a devices 4glprogram
malutz
17th September 2004, 13:19
Is the device script also located in Baan? I guess that the export and import functions only work within Baan.
macoxy
17th September 2004, 13:34
Yes it is.
I think the problem is that first report script is finished and then device script is started. I dont know
tools123
17th September 2004, 13:35
do you have the variable declared as extern in the report script?
macoxy
17th September 2004, 13:40
yes i decleared it as extern
malutz
17th September 2004, 14:06
If the report script is already finished than the variable is no longer available.
How and when do you start the device report?
macoxy
17th September 2004, 14:21
i dont know when the device script is started,
but if i do a ps in a shell both report an device script are running.
tools123
17th September 2004, 14:22
Adding to what Malutz is saying,
trace your variable and the actual call for "export".
what section of report have you coded it.
look for the part of script just b4 the transfer to your device code and ensure your variable is not set to zero or blank as your case may be.
if needed you may use an additional variable to store the value if the orig variable is supposed to be reset logically.
macoxy
17th September 2004, 15:03
the device is started with rprt send in session script but i do not have access to session script. only to report script.
So i do not know when the session in finished.!
JaapJD
17th September 2004, 15:22
I'm almost sure the report process has gone when the device program is started. But why don't you print the value you need on the report and extract (and remove) it in your device program?
To prevent that value being printed to other devices you can use the print condition (e.g. spool.device = "your device").
macoxy
17th September 2004, 15:40
I think it would be easier just to create a file with value of variable, becouse there are just 3 possible values, in report script and then search for file in the device script.
JaapJD
17th September 2004, 15:44
That is indeed also an option, but be aware of multi-user aspects. You should name the file with a unique identifier, like bshell.pid().
macoxy
17th September 2004, 15:48
i did not think about this you are right.
But i think i will have a little more problems with reading data from report file with baan programing language.
I havent done this before!
Hitesh Shah
17th September 2004, 15:52
Variable export/import will work only if the device script is started by the report script. If report script starts the device script , then declare the variable extern in report script . This is not done in ur example . Plain import in the device will work in this case.
If the device script is the 4GL script at the device data, then it's not invoked by the report. It's invoked by ttstpsplclose. In such a case, u can do following thing.
In report script
extern domain tccwar testvar
export ("free$",testvar)
In the device script,
long proc_num
domain tccwar testvar
import("parent",proc_num) |get the parent of ttstpsplclose
get.var(proc_num,"free$",testvar)
I have report with script wich i send to device with her own script,program
how to export one variable from report script to device script,program??
report script:
domain tcmcs.str3 jezik
export("jezik",jezik)
device script
extern domain tcmcs.str3 jezik
import("jezik",jezik)
this does not work
macoxy
17th September 2004, 15:59
that is nice pice of code.
how to get the proc_num with ps or what?
malutz
17th September 2004, 16:04
No, proc_num you get with executing this code
import("parent",proc_num) |get the parent of ttstpsplclose
JaapJD
17th September 2004, 16:11
You can convert the internal Baan format to ascii first before you process the report contents. Just call the ttstpconv in your own device script, like this:
wait.and.activate("ottstpconv", argv$(1), argv$(2), "ascii", argv$(4),argv$(5))
argv$(2) will contain the filename of the file you have to process.
macoxy
17th September 2004, 19:05
Thanks all of you i did it with Hitesh Shah solution it works great.
THANKS AGAIN
Hitesh Shah
20th September 2004, 07:32
Jaap,
Is it possible to elaborate on the ttstpconv arguments. I have never used it. It may be of use to us later on.
Thanks in advance.
maxime
21st September 2004, 12:54
Declaring the variable to be exported in both the report script and the device script as "extern" should solve the problem. Additionally, I feel that there is no reason to Export and Import it. Just exporting should be sufficient.
Maxime.
JaapJD
21st September 2004, 14:01
Is it possible to elaborate on the ttstpconv arguments. I have never used it. It may be of use to us later on.
arg$(1) is the input file, with the report contents in internal format
arg$(2) is the outputfile entered by the user or the default one of the device
arg$(3) is the argument specified at the device, in my example always set to 'ascii'
arg$(4) ... I don't know, but if the device program gets more arguments, they will be passed to ttstpconv as well
maxime
21st September 2004, 16:07
Hi,
The BaanERP 4GL program that is carried out before the output is sent to a file. At present, only the Conversion to Wordprocessor (ttstpconv) program is implemented. ttstpconv (Conversion to Word Processor)
Filter Type Argument
ASCII : [ascii] or [ASCII] or [vi]
UNIPLEX : [uni] <parameter>
VENTURA : [vp]
WORDPERFECT: [wp5.0] or [wp50]
POSTSCRIPT : [postscript] or [POSTSCRIPT]
RTF : [RTF]
Default value
The default value is UNIPLEX [uni].
POSTSCRIPT is especially intended for the Print User Documentation (ttadv7450m000) session.
You can also process the generated output file through a shell command. For example, after conversion, the file must be sent to metafax. You can do this by defining a "\" and the shell command behind the filter type.
Example
ASCII\mfax %s; rm %s where ASCII is the filter type and mfax is the shell script. The shell script "mfax" must be called with the output file as argument. This can be done by putting %s after "mfax". After running mfax, the output file is removed by "rm".
No Help available.
Field Specification
Type: Alphanumeric
Length: 13
Mandatory: No
As per the Help Doc for ttstpconv.
What do you exactly want to do after sending the file to Lotus Notes?
Maxime.
Hitesh Shah
21st September 2004, 16:27
Jaap,
Thanks for the information on arguments.
Maxime,
The information u provided is there already in Baan help in Baan IV. We are not sending the output to lotus notes. As of now we are not using ttstpconv and do not have any plans in near future.
macoxy
22nd September 2004, 20:36
I just finished with my program, for sending reports(orders) with header and footer(bitmaps) from baan direct to lotus notes like attachment.
I used a little bit of baan coding and visual basic(to add a picture header and footer and to convert it to pdf and send to LN).
How did you realized your program?
Hitesh Shah
23rd September 2004, 08:01
Macoxy,
Can u post the VB code for converting to pdf .As of now we dont need it.But imagine we may require it later on.
Thanks in advance.
macoxy
23rd September 2004, 12:57
This is baan code to print report to pdf you will need ghostscript installed on local PC. I don,t use it becouse i can't print bitmaps from baan to pdf.
So we use program called 602Pro PRINTPACK 2002 which i call it from Visual Basic when i allready have document in shape that i want :)
function create_pdf()
{
appl="C:\ghostscript\gs8.00\bin\gswin32c.exe"
long fp1, fp2
string tmp.file1(1024)
string tmp.file2(1024)
tmp.file1 = creat.tmp.file$( bse.tmp.dir$() )
tmp.file2 = creat.tmp.file$( bse.tmp.dir$() )
fp1 = seq.open(tmp.file1, "w")
fp2 = seq.open(tmp.file2, "w")
seq.puts("-q -dNOPAUSE -dBATCH -sDEVICE#pdfwrite", fp1)
seq.puts("-sOutputFile#"&"c:\lotusbaan\attachment.pdf", fp1)
seq.puts("-q -dNOPAUSE -dBATCH -sDEVICE#pdfwrite", fp2)
seq.puts("-sOutputFile#"&"c:\lotusbaan\attachment.pdf", fp2)
seq.puts("-c save pop -f " & "c:\lotusbaan\attchment.ps", fp2)
seq.puts("-q -dNOPAUSE -dBATCH -sDEVICE#pdfwrite -c save pop -sOutputFile#"&"c:\lotusbaan\attachment.pdf" & " -f " & "c:\lotusbaan\attchment.ps", fp1)
seq.close(fp1)
seq.close(fp2)
send.report.to.client(tmp.file1, "c:\lotusbaan\_.gs1")
|send.report.to.client(tmp.file2, "c:\lotusbaan\testpdf.txt")
ret = rdi.domain.enum.value( "tugs",1,"2",app1,appl,fval)
ret = app_start(appl & " @_.gs1", "c:\lotusbaan\","","","")
if ret >= 0 then
while app_status(ret) <> 0
suspend(500)
endwhile
else
message("Aplikacije BAANPDF ni bilo mogoce zagnati!")
exit()
endif
send.report.to.client(tmp.file2, "c:\lotusbaan\testpdf.txt")
ret = seq.unlink(tmp.file1)
ret = seq.unlink(tmp.file2)
}