UPDATE Command

The UPDATE command changes the values in the relational database to reflect the current values of the iFIX tags.

SQT1 – the SQL Trigger block uses the following UPDATE command defined in the SQLLIB table:

Update TBL1 set COL1=?, COL2=? where COL3=?;

SQD1 – the SQL Data block references three tag and field name combinations in the database, and sets the direction for the data transfer to OUT.

T01-. AI1.A_DESC

T02-. AO1.F_CV

T03-. DO1.A_ADI

TBL1 – is the table referenced by the UPDATE command used in the SQT block.

COL1

COL2

COL3

Pump stage 101

99.7

Hello

Temp Zone 2 (C)

-2.1

ByeBye

Manual Override

.004

what

AI1 Descriptor

21.04

ABDFG

Explanation

When the software executes this command, it looks at each value in COL3 for the value that matches the A_ADI field for the DO1 block. Since the last row in the table matches, the system updates that row. COL1 and COL2 receive new values from AI1's descriptor and AO1's current value, respectively.

The resulting table is shown below:

COL1

COL2

COL3

Pump stage 101

99.7

Hello

Temp Zone 2 (C)

-2.1

ByeBye

Manual Override

.004

what

New Descriptor

-23.09

ABDFG

New Descriptor – comes from the AI1 block's A_DESC field.

-23.09 – comes from the AO1 block's F_CV field.

ABDFG – comes from the DO1 block using the A_ADI field.

iFIX does not support updates to a date column. If you need to update a date, we recommend that you carefully consider the design for your relational database tables. Consider what data needs to be accessed and how. For example, you may want to keep the year, month, and day in separate columns and then update each column individually.

If the SQL task cannot read a value from a block, it substitutes a null value in place of the block value. If the target column does not accept null values, rows are not updated and the SQL task generates an error. The SQT block also generates an alarm.

See Also