Table 16, Comparing different format strings – Vaisala Hydromet Data Collection Platform User Manual

Page 166

Advertising
background image

User's Guide ______________________________________________________________________

164 _________________________________________________________________ M210933EN-C

3.

Next, format the data. The format of the data string is defined in the
Format field. By clicking the Default button, a default format
string for the selected data items appears. The format string for the
scan ordered example report above would be as follows:

%[////]4.1f %[///]3.0f %[//////]6.1f\r\n

Any characters between the previous item and the next % character
will be read as a field separator before the next data value. In the
example above the field separator is a space. To use a tabulator as
the field separator, replace the space with \t. The characters \r\n at
the end of an item indicates that a line-feed is inserted at the end of
each data record.

When specifying the number of characters shown for a data item,
the data field always has fixed length.

Table 16 on page 164

shows

a few examples of the data value 2.345 formatted using different
format strings.

where
%

=

Starts each data field

[ ]

=

Contains the characters for invalid data, for
example, //////

4

=

Indicates the number of characters

.1

=

Indicates the number of decimals

f

=

Ends the data field (of a decimal number)

Table 16

Comparing Different Format Strings

Format String

Data Item

Description

%[////]4.1f

" 2.3"

Fixed length, padded with leading
spaces

%[////]04.1f

"02.3"

Fixed length, padded with leading
zeroes

%[/////]+05.1f

"+02.3"

Sign of value included also for positive
values

%[//].1f

"2.3"

Dynamic length, automatically
changed depending on data value

%[//]+.2f

"+2.34"

Dynamic length, sign included

Advertising