To edit a record of the Historic, you must use the UPDATE clause. This is the SQL code structure.
UPDATE (function used) TABLENAME (table used) SET FIELDNAME2 (field of the variable to modify) = NEWFIELDVALUE WHERE FIELDNAME1 (field of the variable used as a filter) = FIELDVALUE
As shown in the next example.
Figure 1: Example SQL code for editing records
In this example, FieldVar2
is the variable to modify and FieldVar
is the variable used as a filter.
To select and set a value to a variable, you must write to the variable which is used as a filter, whether it is a date or a value.
The method used to set a filter value and the new value to the selected record is SetVariableValue, as displayed in the following figure.
Figure 2: Script showing how to use the SetVariableValue method
In this example, FieldVar2
is the variable to modify and FieldVar
is the variable used as a filter.
Exercise
- Create a Query and a button to update values on the table, using the Setpoints created previously.