Using CitectSCADA > Using Devices > Formatting Data in the Device > dBASE and SQL database devices format

dBASE and SQL database devices format

The format specifies the structure (field names and field widths) of the database. The format has the following syntax:

{<field name>, <width>}

You need to use braces ({ }) to enclose each field, for example:



In this case, the database is created with two database fields - Tag, with 8 characters, and Name, with 32 characters. The size of each database field is determined by the width you specify in the format. (Justification character are ignored.) Every database field is character (string) field types.

You can define your own fields (as well as the standard CitectSCADA fields) for the database device, for example:



This database device has the following structure:

Don't leave any spaces between each field definition or at the end of the format string, or CitectSCADA creates extra fields for each space (in the device). Do not specify a field name longer than 10 characters, or CitectSCADA truncates the name to 10 characters. (The dBASE file format limits field names to a maximum of 10 characters.)

In this example, the database is created with seven database fields. To access the above dBASE device, use a Cicode function similar to the following:

hDev = DevOpen("Recipe");
DevFind(hDev, "Name", "Bread");
PLC_Water = DevGetField(hDev, "Water");
PLC_Sugar = DevGetField(hDev, "Sugar");
. . .
. . .