Cicode Programming Reference > Cicode Function Categories > Format Functions Introduction > FmtOpen

FmtOpen

Creates a format template. After you create a template, you can use it for formatting data into strings or extracting data from a string. To format a template, use the same syntax as a device format, that is {<name>[,width[,justification]]}.

Syntax

FmtOpen(Name, Format, Mode)

Name:

The name of the format template or Alarm Category.

Format:

The format of the template, as {<name>[,width[,justification]]}. Not used for alarm format.See Format Templates for more information.

Mode:

The mode of the open:

0 - Open the existing format.

1 - Open a new format.

2 - Open Summary Format from Alarm Category specified by Name.

3 - Open Display Format from Alarm Category specified by Name.

Return Value

The format template handle, or -1 if the format cannot be created.

Related Functions

FmtClose

Examples

hFmt=FmtOpen("MyFormat","{Name}{Desc,20}",0);
FmtSetField(hFmt,"Name", "CV101");
FmtSetField(hFmt,"Desc","Raw Coal Conveyor");
Str =FmtToStr(hFmt);
! Str will contain "CV101 Raw Coal Conveyor".
FmtOpen("0", "", 2);
! Display Format from Alarm Category 0
FmtOpen("0", "", 3);
! Summary Format from Alarm Category 0.

See Also

Format Functions