lbencic
9th April 2003, 18:54
In Baan V you use the Form Commands session to attach other sessions (functions and menus) to a Form. If you specify 'Activate a Function', you program that function in the main script of the session. If you specify 'Activate a Session' is there a corresponding section in the script I can program? I seem to think there should be, and I did find reference in the Programmers Guide:


BaanERP Programmers Guide:

4GL choice sections
--------------------------------------------------------------------------------
You use choice sections to program actions that you want to be executed when standard commands or form commands are activated or ended. Choice sections consist of a main section and a subsection. The main section specifies the standard command or form command for which the actions must be executed. The subsections specify when the actions must be executed.

Main section
choice.<standard command>:
The subsections associated with this main section are executed for the specified command. You can enable standard commands and specify form commands from the session Sessions(ttadv2500m000). A list of standard commands appears at the end of this help topic. For form commands, the session, menu or function name is used.



This seems to indicate I can code something like:


choice.tiedm1201m000:
before.choice:


If the session tiedm1201m000 is attached as a session to the Form in Form Commands, which would be really cool :), but this does not compile. There is no example in the guide, and my eyes are going blinky from grepping 'choice' everywhere...
I also tried
choice.201:

where 201 is the ID of the Form Command....nothing compiles. I know I can move this to a function and code the zoom.to$ there, but I would rather not change the standard form.

mgakhar
9th April 2003, 19:00
Not sure as to what you want to code in the Program script when activating a session. But when u activate a session in the form command, there isnt any section in the program script for you to code.
Basically you will have a button u can click to start the session u added in the form command or a menu item under Application menu on the session where u would have a link to start the session u want to activate.

Manish.

lbencic
9th April 2003, 19:09
I wish to check something before zooming...I don't think that is too uncommon.
I would agree, except for the help I found that is so specific, saying that I could program for the Form Commands: session, menu or function, which are exactly the choices I am looking for. It just does not give the syntax, and maybe it is not even active.

lbencic
9th April 2003, 20:05
Well, I did find an example in the help:



choice.ttadv2111m000: | form command
before.choice:
export_var = "some value"



But when I try the session name, it does not compile. I am guessing since I do have the syntax right that this either was a pipe dream when they were writing the help, or it has been disabled for some reason. We have current porting sets/sp's.

sujoy.sen
9th April 2003, 21:47
Did you consider using choice.user.0 (or choice.user.1, etc.) ? Not sure if this helps. Wouldn't you have to change the standard form irrespective of which way you decide to go?

lbencic
9th April 2003, 21:53
Yes, I'm moving it to a function (in V functions = user options from IV). I do have to change the form to do so.

I'm using a wrapper around the script (our version, RMCgen, like QKEY and 'rush'), so no actual script / source changes. In fact this was such a nice demonstration of that technique..I was hoping to keep the form out of it as well. The standard form has the session attached like that. *sigh*

sujoy.sen
9th April 2003, 22:19
I didn't realize that the session was already attached to the form ... thought you were putting in something new. It all makes sense now. Looked like you were trying different choice options there and I think the user.x extensions are pretty much the only 'non-standard' ones that are compilable (even in V).

You're right: that would have been a good demonstration of the technique. Good Luck!

lbencic
10th April 2003, 00:17
A Ha. Where there is a will there is a way.
I found this does go through the choice.zoom section, so I have my code now saying:


choice.zoom:
before.choice:
if strip$(fattr.zoomsession$) = "tiedm1201m000" then
do my logic
endif


I can leave the form as is, being called as a session direct. I guess that maps to the ole 'choice zoom' option in Baan IV, where you were allowed to attach a zoom session to the choice field. Now you can attach many though, but same section in the code.

sujoy.sen
10th April 2003, 15:29
This is pretty cool! Forgot about choice.zoom and certainly didn't know it could be used this way. Will have to make a note of it for later reference. Thanks for the post!