The device format specifies how to format the data in the device. The format is determined by the type of device, and the data that is sent to the device.
The format specifies how each line of data is printed on the printer or written to the ASCII file, for example:
RFP3 Raw Feed pump 3 Overload 12:32:21
RFP9 Secondary Feed Overtemp 13:02:45
To include Citect SCADA data you need to specify the field name and (optionally) a width for each field to be printed or written to the file. The format has the following syntax:
{<field name>, [width[, justification]]}
You need to enclose each field in braces {}, for example:
Format |
{Tag,8}{Name,32} |
In this case, two fields are printed or written to the file - Tag, with 8 characters, and Name, with 32 characters. The width specifier is optional - if you do not specify a width, the width of the field is determined by the number of characters between the braces, for example:
Format |
{Name } |
In this case, Name is followed by four spaces - the field is printed or written to the file with 8 characters.
List and Tables
To set the justification of the text in each field, use a justification specifier. You can use three justification characters, L (Left), R (Right), and N (None) - for example:
Format |
{Tag,8,L} {Name,32,R} |
The justification specifier is optional - if it is omitted, the field is left justified. If you use a justification specifier, you need to also use the width specifier.
To display field text in columns, use the tab character (^t) - for example:
Format |
{Tag,8}^t{Name,32}^t{Desc,32} {Time,8,R} |
Fixed text
You can include fixed text by specifying the text exactly as it is to be printed or written to the file - for example:
Format |
Name of Alarm: |
Any spaces that you use in a text string are also included in the string.
Note: When producing reports, the device format is ignored. The format for the report is defined in the report format file.
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:
Format |
{Tag,8}{Name,32} |
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 Citect SCADA fields) for the database device, for example:
Format |
{Name,16}{Water,8}{Sugar,8}{Flour,8}{Salt,8}{Yeast,8}{Milk,8} |
This database device has the following structure:
Do not leave any spaces between each field definition or at the end of the format string, or Citect SCADA creates extra fields for each space (in the device). Do not specify a field name longer than 10 characters, or Citect SCADA 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");
. . .
. . .
DevClose(hDev);
DBase Devices
If the database does not exist, it is created with the specified format. If you do not specify a format, and if the file name specifies an existing dBASE file, Citect SCADA uses the existing fields in the database.
SQL Devices
You need to create the SQL database by an external application before it can be used.
If you edit a dBASE or SQL device record (in an existing project), the associated physical device is not edited. For example, if the device is a dBASE type device and you add an extra field in the device, the extra field is not added to existing database files (when you run Citect SCADA).
If you want to make changes to the file structure of an existing database and retain existing data, you need to manually edit the data using dBASE, Excel or some other database tool.
If you want to make changes to the file structure of an existing database and don’t want keep the existing data:
When the device is opened, no device file is available and a new data file is created with the necessary changes.
See Also
Published June 2018