GetCmpGateValueAsString

Top  Previous  Next
Description        

It returns the value of the specified gate as a formatted text string.

 

Syntax                

String GetCmpGateValueAsString(String Name, Int Id,String Format)

 

Parameters

Name = name of the gate you want to read

Id = identifier of the gate you want to read

Format = format of the returned text.

Using the “%g” format, the software will show the real number using the less space possible (if needed using the exponential notation). If  you want to specify how the number should appear, is possible to use the notation “%x.ylf”, where:

·                x is a number (optional), and indicates the number of digits to show. If it is not present, all digits from the value read from the gate will be shown. If it is preceded by a 0, some 0 before the number will be shown in order to reach the specified number of digits.

·                y is a number (optional), and indicates the number decimal digits to show.

If y is equal to "*" then the number of decimal digits to show is the number of decimal digits defined for the                                given gate (this number is defined using Gate Builder).

 

Some examples:

“%5.2lf” will produce 123.45

“%5.0lf” will produce 123

“%07.2lf” will produce 00123.45

"%7.*lf" will produce 123.456 if the number of decimal digits defined with Gate Builder for the gate associated to the label object is equal to 3.

 

In the same way it is possible to specify the format for integer number (“%xd”) . The meaning of the x parameter is the same described above.

 

 

 

 

 

Returned value

value of the specified gate as formatted text

 

Related functions

GetCmpGateValue()

 

Example                

int Gate12Id;

String Gate12Name;

Sring Value;

Value = GetCmpGateValueAsString(Gate12Name, Gate12Id,"%6.*lf");