I have almost all of the kinks worked out of a fairly large script to make sure we don't schedule too many appointments for interviews.
The last piece is to update the control table by incrementing a "used" field corresponding to a specific time on a specific day.
My code already has the date and time selected and all that works just as needed.
The problem is that I need to construct one line of code that will update one of 8 specific fields in a record as determined by an x-dialog selection. I know the specific time, and in my code, I determine which field number it is. all fields are named "T{fieldnumber}_oused".
What I want to do is to create a change operation on the table that would be
tbl.t1_oused = tbl.t1_oused+1 where "1" could be a number between 1 and 8.
The following code shows what I have done, I have tried "evaluate_template(evaluate_string())" to no avail.
From the interactive:
any help would be appreciated.
Tom
The last piece is to update the control table by incrementing a "used" field corresponding to a specific time on a specific day.
My code already has the date and time selected and all that works just as needed.
The problem is that I need to construct one line of code that will update one of 8 specific fields in a record as determined by an x-dialog selection. I know the specific time, and in my code, I determine which field number it is. all fields are named "T{fieldnumber}_oused".
What I want to do is to create a change operation on the table that would be
tbl.t1_oused = tbl.t1_oused+1 where "1" could be a number between 1 and 8.
The following code shows what I have done, I have tried "evaluate_template(evaluate_string())" to no avail.
Code:
'now lets update the record with a new interview dim incr as N = 0 incr = case(time="8:00 AM",1,time="8:30 AM",2,time="8:45 AM",3,time="9:00 AM",4,time="9:15 AM",5,time="9:45 AM",6,time="10:15 AM",7,time="10:30 AM",8) dim tbl as P tbl = table.open("appt_control") tbl.index_primary_put("A_Date") tbl.fetch_find(SELECT_DATE) fldname = "T"+alltrim(str(incr))+"_oused" tbl.change_begin(.t.) evaluate_string("tbl.{fldname} = tbl.{fldname}+1") tbl.change_end(.T.) tbl.close()
From the interactive:
Code:
?fldname = "T7_oused" ?evaluate_string("tbl.{fldname} = tbl.{fldname}+1") = "tbl.T7_oused = tbl.T7_oused+1"
Tom
Comment