vaishali_sftdev
15th May 2008, 05:48
Hi,
Can anyone tell me that in AFS it is possible that we can set the fields that are other than the form fields? In AFS, functions only work on the form fields or also on the fields that are other than the form fields example, that may be one or more table fields that were not placed on the form? Reply ASAP.
mark_h
15th May 2008, 14:26
Yes you can - you can search this forum. I just did another post on that. I know for a fact it works but basically you set the fields in your AFS code. Then export them and import them(into the appropriate event) in the session you are calling. The key to this is getting the import into the correct spot so that the called baan session does not re-set them. Please note that it helps to have source code for this. In my case I have successfully done this use Qkey. All I did was put the session in debug, run the AFS code, then track through the baan session where the field was set and what changed it. Doing this I would locate the spot where I would then do my import.
vaishali_sftdev
15th May 2008, 20:32
Mark,
thanks a lot for the reply. I am doing same as u told. I tried importing it, but the value is always 0 in before.program section in baan session. Does the place from where I exporting also matter? In AFS code, before setting the fields of the sub-session, i am exporting the variable.
mark_h
15th May 2008, 20:46
Yes - you should set the field before starting the session. So before the session is activated you must set the field. Then when the session is activated and the import happens it will get the value you set.
vaishali_sftdev
16th May 2008, 06:32
Mark, using Qkey is mandatory in this case?
pconde
16th May 2008, 09:55
Hi,
you can use stpapi.put.field to import data in the session called via AFS. I do this commonly.
point to attention :
- the field must be defined as extern in the script
- if you use table field you must be sure that the record is not overwritten later ==> If you execute a find the stpapi.put.field must occurs after the find
I have the sources so mostly I define an new exern variable and fill it via stpapi.put.field. Then in the script I update the table field with this value or do something specific if this field is filled (p.ex avoid execute choice.again)
Regards
Philippe
mark_h
16th May 2008, 13:29
Mark, using Qkey is mandatory in this case?
For me it was since I did not own source code. See Philippe's answer below - I have never tried that. In my case it would not have worked because the field values would get changed in one of the events. So then when I just found where I needed it to be.
A side note - some of the stuff I import between sessions are record buffers. This was the only way I could get AFS code to work. I did this several service packs ago and I have not gone back to see if I need it anymore.
vaishali_sftdev
17th May 2008, 06:39
Hi Philippe & Mark,
Thanks a lot for replies.
Its been solved as Phillippe explained the solution.