I have a grid with a Run type button. When I check-off records and run it, it updates a second table and does that perfectly. I then want to flag the record in the first table to show it was processed. I do this by setting a flag (ToBill) to ONE. The code I have, however, sets ALL the records in the table to 1. How can I change this?
//button run event onRecord
sc_lookup(variable, “SELECT COUNT(*) FROM tblBillItems WHERE Project = ‘{TimeProject}’ AND client = ‘{Time_clientCode}’”);
if({variable[0][0]}!=0)
{
sc_exec_sql(“UPDATE tblBillItems SET Project = ‘{TimeProject}’, Client = ‘{Time_ClientCode}’,hours = hours + ‘{Amount}’ WHERE Project = ‘{TimeProject}’ AND client =
‘{Time_ClientCode}’”);
[SIZE=14px] sc_exec_sql(“UPDATE tblTaskTime SET ToBill = 1”); [/SIZE]
}
else
{
sc_exec_sql("INSERT INTO tblBillItems (Project,client, hours) VALUES ('{TimeProject}','{Time_clientCode}','{Amount}')");
}