OK I discovered some issues after some testing. first when I remove Previous/Next from the toolbar the form stops SAVING data. This would be basically interpreted as BUG, but I think there is more to it. The macros mentioned initially in some situations work and in some don’t. I could not yet grasp the pattern. If is very hard to debug anything without and help from company or tool. I have asked several times if there are any variables to test if the form is opened in INSERT, UPDATE or DELETE mode ? Still go not answer although such testing should be possible and there must be some kind of values to determine this since the macro was created for that purpose.
I would appreciate if somebody can test this form (opened from Menu without Prev/.Next buttons).
I have this simple code to test against config record and then based on that open the configuration form in either INSERT or EDIT mode.
// Selection for CONFIG
if ({sc_menu_item} == "item_50")
{
$query1 = ("SELECT UID, companyname FROM g_systemsettings WHERE UID=1");
sc_lookup(rs, $query1);
if (isset({rs[0][0]}))
{
sc_apl_conf ("fm_g_systemsettings", "insert", "off");
sc_apl_conf ("fm_g_systemsettings", "delete", "off");
sc_apl_conf ("fm_g_systemsettings", "update", "on");
}
else
{
sc_apl_conf ("fm_g_systemsettings", "update", "off");
sc_apl_conf ("fm_g_systemsettings", "delete", "off");
sc_apl_conf ("fm_g_systemsettings", "insert", "on");
sc_apl_conf ("fm_g_systemsettings", "start", "new");
}
}
although for some reason it is not working as expected. Form opens in Edit mode but the Insert(Add) button is visible etc. I can’t figure out why it is not working. The code is placed in onExecute event. I wanted to set some global Var’s then read them in config form, but this isn’t working as well (seems like any globals set in Menu are ignored). I would appreciate your comments - if I’m doing something wrong here…
Thank you