Format string

Format strings specify the formatting of text fields and those plain texts used as output fields. Format strings consist of five arguments, although not all of these need to be specified. The position of the arguments in the string must be defined, however. For instance, if only the third parameter is to be set, the string must contain at least two commas, followed by the third parameter.

Syntax

"[Format,EmptyifZero,LeadingZeros,Alignment,Exponentialrep]"

The format will be generated in the following format:

width[.decimal places]data type

The data type symbols used are shown in the table below:

Format Example Parameter to set
floating point numbers 12.34 f
integers 1234 d
strings abcde s
password String as "*******" S
time The time itself can be displayed in different formats:
YY.MM.DD HH:MM:SS.mmm 2010.10.20 12:39:37.468 t
Local Date and Time 10/20/2010 2:00:24 PM %ct
Local Date 10/20/2010 %xt
Local Time 2:00:40 PM %Xt

Custom

These can be combined with each other. For example if "[%a%d%b%Yt,...]" was defined, the time is written as "Wed20Oct2010".

Short name of weekday Wed %at
Full name of weekday Wednesday %At
Short name of month Oct %bt
Full name of month October %Bt
Day of month (1-31) 20 %dt
Month 10 %mt
Year with century 2010 %Yt
  • floating point numbers:
    • Here the width is the number of digits before the decimal point. When the requested width is larger than the number of digits before the decimal point of the float value, then spaces or zeros (if the Leading Zeros option is enabled) will be used to pad the field width. Some shapes (e.g. Text Field) do not allow spaces for numeric values, so the leading spaces will not be shown
    • The decimal places represent the number of digits shown after the decimal point.

The remaining arguments are binary values:

  • If EmptyifZero is set to true, the text field stays empty when the value to be displayed is zero. For false '0' is displayed. In case of a null time in the time format the result is an empty string.
  • If LeadingZeros is set to true, the specified number of integer digit locations are filled on the left with zeros.
  • If Alignment is set to true, the text is left-aligned in the field, and right-aligned for false.
  • For text fields and simple texts (and table columns) following alignments are available:

    AlignLeft, AlignRight, AlignHCenter (default) for horizontal alignments and

    AlignTop, AlignVCenter and AlignBottom for vertical alignments.

    They can be combined using a pipe to configure additional alignment combinations, e.g."AlignLeft|AlignBottom".

  • If Exponentialrep is set to true, the display is provided in exponential format.

The format string must not contain any spaces. Spaces after commas, for instance, will mask the associated parameter.

If you do not want decimal places to be displayed, use the format string 4d.

When editing a simple text inside of the GEDI it is always displayed as aligned to the center.

Example

The primitive text "text1" is set to an eight-digit string field with left alignment and texts of that length will be displayed.

main()
{
  int x;
  x = setValue("text1", "format", "[8s,,,TRUE,]");
}