Skip to main content

Format of the Output

Goal

The format <format> is used in almost all the Work Task rules, and describes how the output of the rule is formatted when stored into the database. E.g. the output format of the mask, randomize, shuffle, etc.

The <format> part will be a combination of

  • Format specifiers %d, %.2f, %s, %tF, %tT
  • Literal strings: "My literal string"

By default, each format specifier refers to its own <input source>. It is possible to draw data from one input source into multiple format specifiers (using 1$, 2$, etc.), as is the case for DateTime input sources.

Note
  • Format specifiers alone can be written without double quotes "". Else it should be quoted ("my phone number is: %d")
  • When a transform <transformation> is used, the formatted output is the input to the java transformation method specified in <transformation>. The result of the transformation is what will be stored back to the database
  • Without any format specifications the value is regarded as a constant
  • The text constant NULL is regarded as SQL NULL
  • Each format specifier must be matched with one input source

Constructing the format string

Deciding the format specifier

The <input source> most often decides for you which format specifier you want.

  1. %d - random-integer, sequence, randomize (integer)
  2. %f - random-decimal, randomize (decimal)
  3. %s - file, column
  4. %tF - random-date, randomize (date)
  5. %tT - random-time, randomize (time)
  6. "%1$tF %1$tT" - random-datetime, randomize (datetime)

ANO format <format> Examples

// ---- Numbers ----
<rule>
format %d // integers
<input-source>
<rule>
format %f // decimals
<input-source>
<rule>
format %.2f // decimals with 2 decimal places
<input-source>
<rule>
format %.4f // decimals with 4 decimal places
<input-source>

Java Formatter Documentation

For a thorough guide on the definition of different flags (e.g., %f, %tT, ... ), see