Cicode Programming Reference > Cicode Function Categories > Device Functions Introduction > DevSetField

DevSetField

Sets new field data in the current record in a device.

Syntax

DevSetField(hDev, Field, sData)

hDev:

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

Field:

The field name, as a string of up to 10 characters. (The dBASE file format limits all field names to a maximum of 10 characters.)

sData:

New field data, in string format. CitectSCADA converts any other data type into a string before setting the data.

Return Value

0 (zero) if the data is successfully set, otherwise an error is returned.

Related Functions

DevOpen, DevAppend, DevGetField

Example

! Set the fields in the "Recipe" device.
hDev=DevOpen("Recipe", 0);
DevSeek(hDev, 1);
DevSetField(hDev,"Name", "WhiteBread");
DevSetField(hDev,"Flour", IntToStr(iFlour));
DevSetField(hDev,"Water", iWater:####);
DevSetField(hDev,"Salt", iSalt);
DevClose(hDev);

See Also

Device Functions