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

DevGetField

Gets field data from the current record in a device.

Syntax

DevGetField(hDev, Field)

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.)

Return Value

The field data (as a string). If the field is not found an empty string is returned.

Related Functions

DevOpen, DevSetField

Example

INT
FUNCTION
GetRecipe(STRING sName)
INT hDev;
hDev = DevOpen("Recipe", 0);
IF hDev >= 0 THEN
DevSeek(hDev, 1);
IF DevFind(hDev, sName, "NAME") = 0 THEN
PLC_FLOUR = DevGetField(hDev, "FLOUR");
PLC_WATER = DevGetField(hDev, "WATER");
PLC_SALT = DevGetField(hDev, "SALT");
PLC_MILK = DevGetField(hDev, "MILK");
ELSE
DspError("Cannot Find Recipe " + sName);
END
DevClose(hDev);
ELSE
DspError("Cannot open recipe database");
END
END

See Also

Device Functions