Testing form for MODE

There is a SC Macro to set form mode

sc_apl_conf("Application", "Property", "Value") This macro allows to modify the property of the application. The user can determine if a Form will start in insert mode, or a Grid starts by filter, etc.

This macro must be used by one application to modify the properties of another application.
  
 

How can I test the mode that has beep applied ?
another workds I want to test if the form was opened in INSERT or UPDATE or DELETE mode. I assume if we can use this macro there has to be some variable that hold the Property/Value pair information.

Arthur

onValidate you can check for {sc_btn_insert}
Outside validate, you can always check for your PK value. In normal situations, because is calculated by database, has not value opening the form to insert values.

Maybe {sc_btn_new} works for sc_apl_conf, not sure. Try it.

Giu - thanks for replying.

As far as Pk there are two methods.

  • assign the PK value the moment the form is opened (so the record is already created with PK value)
  • reserve PK value in memory, then on validate check the last Pk record and recalculate new value if needed (i.e if in the meantime another station added a new record to the same table)
    I do not know how SC handles those situations (and I would love to find out).

That is why I’m asking because so far sc_apl_conf is not working for me at all. I created another post about that. I’m just calling this macro and no matter what I do the form opens in INSERT mode not in EDIT mode (when needed). For example there is a table with 1 record only. If I open the form for the first time I need to INSERT new record, but when I open the form and record exists I need to EDIT record. When I used other tools (ie. for desktop) there was simply global Var that always keeps the status of an open form and changes this status based on scenario. Tu put it simply is the Var=1 it is INSERT is the Var=2 is is EDIT Var=3 it is lookup Var=4 it is DELETE. We can only have those 4 states for the form. I wish SC have used something like this. It would make calling forms way much easier.
The macro mentioned heere seem to be close to that but so far I tried it in few places and it always fails. Perhaps I’m doing something wrong but not sure what.

At one time you have said that sc_apl_conf MUST be followed by sc_redir(). This isn’t completely true because I have another place in the project where I call sc_apl_conf() from the menu and it works fine (although the name of the called form is still selected in the menu entry). Anyway - in this case now I do similar thing and it is not working.

I wonder if perhaps somebody from NetMake can put some light on the FORM opening modes ???
Arthur

Yes, you don’t need to redir because you are using a link on a menu (this is a redir)

About apl_conf give me a call and we can check it. I use extensivelly it and works as expected.