I need to create a single record form with some configuration settings. The from will be called directly from the menu (no grid) and will always open and update one (and the same) record. How you handle this ?
there will be to scenarios:
- there is no config record yer (so it must be added)
- record exists so it has to be red, changed then saved
here is a starting fragment of code
// Check for record
$check_sql = "SELECT UID, smtpserver, smtpuser, smtppassword, emailaccount, assigmentmode, publicticketsopening, definedparameters, broadcastmessages, defaultpriority, smtpsecurityflag, smtpport, urltrackingscreen, urlconfirmationscreen, defaultlanguage, companyname, urlimgok, urlimgfail, sys_version, sys_release, random_activation_code, timezone, syspa, sysad"
. " FROM G_systemsettings"
. " WHERE UID = 1";
sc_lookup(rs, $check_sql);
if (isset({rs[0][0]})) // Row found
{
{UID} = {rs[0][0]};
{companyname} = {rs[0][22]};
}
else // No row found
{
{UID} = 0;
{companyname} = 'Error';
}
the p.2 is rather easy but I’m confused how to handle adding a new config record. Normally the record is saved then the user clicks SAVE (or UPDATE) button. When the form opens however UID (which is in my case Autonumbered,identification column with the Primary key on it) is empty so the app complains about UID not being autonumbered. I tried to prime UID with number 1 like
UID=1;
although wherever I place this code I still see UID is empty.
Any clues or suggestions ?
thanks - Arthur