Hi, I want my form to go to a new record everytime it is opened.
This form will be opened via a link from another form’s field.
When I click the link button, it opens this form but shows the first record. I want it opened in record insert mode.
Hi, I want my form to go to a new record everytime it is opened.
This form will be opened via a link from another form’s field.
When I click the link button, it opens this form but shows the first record. I want it opened in record insert mode.
You must use the macro for that.
sc_apl_conf(“Application”, “Property”, “Value”)
I need a code to use inside the same form to go to insert mode.
Something like:
On application init event > go to new record
I think “sc_apl_conf” macro doesn’t work that way or I couldn’t manage to configure it.
ONAPPLICATIONINI
Ex. 1: Forces the “my_form” application to start in the addition mode.
sc_apl_conf(“my_form”, “start”, “new”);
Thanks Alvagar but this doen’t work. On sc_apl_conf description it says:
“This macro must be used by one application to modify the properties of another application”
I want to make this work inside the same form. The form, must go to new record whenever it opens.
You must set the macro in first form. you say: “This form will be opened via a link from another form’s field.”.
Yes, a link to update a select field’s data.
But I can’t write the code for a link. Scriptcase makes it automatically and opens the second form with first record.
Edit: I feel stupid. I must have made a typo error or something. It’s working now, inside the form itself.
At OnApplicationInit event:
sc_apl_conf("xxx_form", "start", "new");
(Th macro must be in other form). If you use 2 forms, and from the first form open the second. Then, in you first form you can put the Code in event onapplicationini.
Or If you use a menu for open the form, you can set the code in the menu in event OnExecute.
I’m just looking into this post and have to say that this macro is not working for me as well, although I call this macro from MENU and then try to open FORM. I have this code in “onExecute” event
if ({sc_menu_item} == "item_24")
{
if ([glo_workerid] == 0)
{
sc_apl_conf ("fm_w_worker_profile", "start", "new");
sc_redir("fm_w_worker_profile", "glo_login=[usr_login]");
}
else
{
sc_apl_conf ("fm_w_worker_profile", "update", "on");
sc_apl_conf ("fm_w_worker_profile", "insert", "off");
sc_apl_conf ("fm_w_worker_profile", "delete", "off");
sc_redir("fm_w_worker_profile", "glo_login=[usr_login]");
}
}
but the Form “fm_w_worker_profile” always opens in Insert mode. Even if the record exists.
What I noticed is VERY SCARY !
Initially the Form worked OK, but I did not like the ADD button When the form was opened in Edit mode. Instead of using sc_apl_sconf() macro I removed the ADD button.
At some point I removed also, Quick search and delete buttons from Toolbar. Then I decided to go different route and re-added those buttons and I wanted to use sc_apl_sconf() in conjunction with sc_redir() macro. Since then then it seems that macros do not work anymore. I don’t know what is going on here but this is not the first time we have this same problem that certain macros stop working. First time it happened I thought it was me doing something wrong but I’m pretty sure there is some BAD interaction between SC and the browser which causes those issues. This is probably the same reason for some Toolbar buttons malfunctioning (they work, then at some point they stop working).
When the App is recreated from scratch and no modifications are made to the toolbar and the same code is pasted, then the macro’s are working again. That’s why when those issues are reported to NetMake they keep saying - there is no bugs, but I’m sure there is an issue , although kinda hard to track. I wish I could have more time to run some tests.
I hope this might be a hint for others to keep your eye on the toolbar changes and observing when the stuff stops working. If this behavior continues I would question completely using SC as it seems to be completely unpredictable when something that worked one day stops working next day when applying simple changes like removing or adding toolbar buttons.
I just re-created the same Form and Copy/Pasted the same code into the same Event and IT WORKS! This is just super scary to spend time on complex form and at some point the Form stops working and we have to re-create it because something (i.e like Macro or Button stopped working). I think both problems (macro and button) are related. After seeing this problem so many times and ensuring I did not do anything wrong I’m pretty sure this is some internal SC-Browser BUG. I suspect it might be related to the TEMP files which remain left after each SC sessions in the folder. I do not really understand why when SC is properly closed those files are not removed (?)