simona
30th September 2009, 13:16
Hello everybody,

I have an AFS problem: I started 2 sessions, actually is one session started two times (first time by stpapi.put.field and the second time by stpapi.synchronize.dialog, the synchronized session is the same like parent session).
My problem is that i can't kill them both. The parent session remains opened. Please see my bellow code.
Please advise :)
Thanks

**********************
stpapi.put.field("whltc1100m000", "whltc100.item", tcibd001.item)
stpapi.put.field("whltc1100m000", "whltc100.clot", f.lot)
ret = stpapi.synchronize.dialog("whltc1100m000", "add", error.msg)
if ret then
retval = stpapi.insert("whltc1100m000", true, dummy.msg)
if not retval then
send.error.to.report("not inserted")
stpapi.handle.subproc("whltc1100m000", "whltc1100m000", "kill")
stpapi.end.session("whltc1100m000")
stpapi.end.session("whltc1100m000")
endif
else
send.error.to.report("not synchronnized")
stpapi.end.session("whltc1100m000")
endif
stpapi.handle.subproc("whltc1100m000", "whltc1100m000", "kill")
stpapi.end.session("whltc1100m000")
stpapi.end.session("whltc1100m000")
********************

mark_h
30th September 2009, 16:07
This is the correct forum for this type question. My question is - I only see one session mentioned, so why use stpapi.synchronize.dialog? If you are entering a record straight to that session you do not need stpapi.synchronize at all. Below is the only commands that I would expect to see for inserting a session.

stpapi.put.field("whltc1100m000", "whltc100.item", tcibd001.item)
stpapi.put.field("whltc1100m000", "whltc100.clot", f.lot)
retval = stpapi.insert("whltc1100m000", true, dummy.msg)
stpapi.end.session("whltc1100m000")

Keep in mind I am not familiar with this session or how it works. See the sticky thread for some documentation on how to use these commands. Check the documentation for the stpapu.sync command would work or when it would be needed.

simona
30th September 2009, 16:28
Session whltc1100m000 is a multiline session, by double-clicking one line it is opened the detail session for editing: whltc1100m000 (the same session, but two separated processes!). So i have 2 sessions to kill/end.

if i skip stpapi.synchronize.dialog(), as you mentioned bellow, i get the message that the synchronized session is not started.

Sim

mark_h
30th September 2009, 17:27
Never heard of that before - a session that opens itself. You can try this before the sync command:
stpapi.handle.subproc("whltc1100m000", "whltc1100m000", "add")

Other than that I do not know how to tell it to kill the processes in the correct order.