Iao_Scaglia
14th July 2015, 12:52
Good morning to all;
I have a problem inserting the value of an array via AFS (stpapi.put.field).
Which is the correct syntax?
This is mine: stpapi.put.field("tdsls1820s000", "qono.select", str$(ord), 10) where qono.select is an array of 10 ans ord is an array of 10.
please help me.
Thanks in advance.
Sergio
sam291091
14th July 2015, 14:27
Hi,
Try this
stpapi.put.field("tdsls1820s000", "qono.select(1)", str$(ord))
Iao_Scaglia
14th July 2015, 14:41
Hi,
Try this
stpapi.put.field("tdsls1820s000", "qono.select(1)", str$(ord))
it doesn't work :(
JaapJD
14th July 2015, 15:05
If ord is an array, you have to take also the element of the array:
for i = 1 to 10
stpapi.put.field("tdsls1820s000", "qono.select", str$(ord(i)), i)
endfor
Iao_Scaglia
14th July 2015, 16:31
There's must be some errors in other points.
My problem is about when the filed "selection" on the print quotation is set to yes.
After pressing "TAB" automatically the subsession tdsls1820s000 is open but I can't be able to pass the specific quotation to the sub session.
my code is this:
if one.document = true then
stpapi.put.field(session, "selection", "2")
else
stpapi.put.field(session, "selection", "1")
endif
....
stpapi.set.report( session, "rtdsls140101000", "PDF_B", error.msg)
stpapi.print.report(session, error.msg)
if one.document = false then
stpapi.handle.subproc(session, sub.session, "add")
endif
stpapi.continue.process(session, error.msg)
if one.document = false then
for i = 1 to 10
stpapi.put.field("sub.process", "qono.select", str$(ord(i)), i)
endfor
stpapi.end.session(sub.session)
endif
stpapi.end.session(session)
No value are pass to the tdsls1820s000; where am I in wrong?
JaapJD
14th July 2015, 17:07
This code is not correct:
stpapi.put.field("sub.process", "qono.select", str$(ord(i)), i)
Change it to this:
stpapi.put.field(sub.session, "qono.select", str$(ord(i)), i)
Iao_Scaglia
14th July 2015, 17:17
Sorry, i write the correct code in the script but not in the post
Still having the same problem... :(
mark_h
14th July 2015, 19:28
Here is what I would change - remove stpapi.print.report. It might be kicking off that subsession before you have control.
if one.document = true then
stpapi.put.field(session, "selection", "2")
else
stpapi.put.field(session, "selection", "1")
endif
....
stpapi.set.report( session, "rtdsls140101000", "PDF_B", error.msg)
if one.document = false then
stpapi.handle.subproc(session, sub.session, "add")
endif
stpapi.continue.process(session, error.msg)
if one.document = false then
for i = 1 to 10
stpapi.put.field("sub.process", "qono.select", str$(ord(i)), i)
endfor
stpapi.end.session(sub.session)
endif
stpapi.end.session(session)
Another thing you can do to check the format is to run ttstpcreatdll on the subsession. Then look in the library that it generates to see what the format looks like for the field.
manish_patel
14th July 2015, 20:00
I think stpapi.put.field() and stpapi.end.session() calls on sub session must have been performed before calling continue process on the main session.
mark_h
14th July 2015, 20:14
I see what you are saying Manish. That continue might actually launch the report and not the subsession (what the tab does). If that is the case, then you need to figure out how to launch the subsession where it is controlled by the main session. I am not familiar enough with the session to make suggestions.
Now what I have done in the past - for printing selected purchase orders. I just take each order the user provides - then I launch the print purchase order session one at a time for each one. When I do this I am usually just sending to a file that will not be printed - or to printer where it does not matter if it was one report or 10 little reports.