Cicode Programming Reference > Cicode Function Categories > Device Functions > DevAppend

DevAppend

Appends a blank record to the end of a device. After the record is appended, you can use the DevSetField() function to add data to fields in the record.

Note: For SQL devices this function is a blocking Cicode function. Data should be added to all requested fields in the row via the Cicode function DevSetField() before DevAppend() is applied.

You need to first call the DevOpen() function to get the device handle (hDev).

Syntax

DevAppend(hDev)

hDev:

The device handle, returned from the DevOpen() function. The device handle identifies the table where all data on the associated device is stored.

Return Value

0 (zero) if the record is successfully appended, otherwise an error code is returned.

Related Functions

DevOpen, DevSetField

Example

INT FUNCTION WriteAlarmCount( INT hDevice, STRING sAlarm, INT iCount, INT iTime )
DevAppend(hDevice);
DevSetField(hDevice, "ALARM", sAlarm);
DevSetField(hDevice, "TIME", IntToStr(iTime));
DevSetField(hDevice, "COUNT", IntToStr(iCount));
END

For SQL devices the above example will not work. Instead use the following example:

 

INT FUNCTION WriteAlarmCount( INT hSqlDevice, STRING sAlarm, INT iCount, INT iTime )
DevSetField(hSqlDevice, "ALARM", sAlarm);
DevSetField(hSqlDevice, "TIME", IntToStr(iTime));
DevSetField(hSqlDevice, "COUNT", IntToStr(iCount));
DevAppend(hSglDevice);
END

See Also

Device Functions

Published June 2018