rosanal
2nd September 2008, 19:31
Hi,
I have problems in use of afs on Baan IV. When I set a field in a SubSession using stpapi.put.field and after stpapi.continue.process to call other

subsession, I have return to field.session of this field to check it, but because I'm using stpapi.continue.process, goes directly to cont.proccess

of this subsession and the field it's not checked so the cont.proccess it's executed with wrong values.
In other example, I used two stpapi.update and was right, but not in this.

Do Anyone knows how (what comand) return to check.input or before.input of field when the stpapi.continue.process is calling?

Thanks!

My code:
stpapi.put.field(sessao.o, "main.ttyp", tfcmg994.tlin.o)
stpapi.put.field(sessao.o, "tfacr200.cuno", str$(tfcmg994.cuno.o))
stpapi.put.field(sessao.o, "tfacr200.ttyp", str$(tfcmg994.typl.o))
stpapi.put.field(sessao.o, "tfacr200.ninv", str$(tfcmg994.docl.o))
|*stpapi.update(sessao.o, false, erro)
|*stpapi.update(sessao.o, false, erro)
if isspace(erro) then
stpapi.continue.process(sessao.o, erro)
|* when the continue.process is executed, I need go to the before.input of "main.ttyp", but goes directly to sessao2.o (line of

|*zoom.to present in cont.process of sessao.o)
stpapi.handle.subproc(sessao.o, sessao2.o, "send")
if isspace(erro) then
executa.afs.ssessao2()
endif
endif

mark_h
2nd September 2008, 20:59
Have you tried save instead of update? Not all events get executed in AFS and in this case you might need code to fix this.

rosanal
5th September 2008, 02:11
Thanks Mark...
yes, I tried use stpapi.save but didn't right...
I modified the Start Option of form to "First" and run corectly... I don't know if is the best way but return the right values even with the two updates...
Do You have some idea what happened when two updtaes it's executed togheter?
I'm using AFS for the first time in this project and I have some dificulties... I hope that, in the end, it's works!:)
thanks once again.

mark_h
5th September 2008, 13:24
I am not sure why in some cases you have to do update twice. Since I do not own code I can't trace through things. I have had to do update twice in at least one spot, then a SP upgrade I had to remove it. Here are some other things I have had to do: change view and a find to get the correct record, a save followed by and update to get the record updated correctly, and update with false followed by an insert to get the record into the session. The weirdest one was I put a field to the session and then had to do a stpapi.save to get it reset, then I could put the fields and do an insert.

Sometimes you just have to play with a session to get things to work. Also one of the drawbacks to using AFS is SP releases. You may have to redesign or change the commands you use to get the session to work with the new release. For SP releases it seems like something usually changes and I have to fix at least one of my AFS sessions. I do not recall ever changing the start option, but will have to keep it in mind.