Print

Functions

JOSF contains a set of useful ways to generate, collect or modify data. A function has the same syntax as a variable, but ends with parenthesis () to include optional parameters. All the default available functions are explained in this section. Since 3.1.0 we also offer an extra pack of real world data generation. The most updated list of these functions can be found at the bottom of this section.

Generating data

To generate data in your Data or Object fields, take a look at these functions.

Random data

The random data functions return a pseudorandom value, each time the function is used.

${random()}

Returns a random 10-character long text containing uppercase and lowercase letters and numbers.

${random(length)}

Returns a random text containing uppercase and lowercase letters and numbers, with with a length set by a numeric parameter.

${random(length, casing)}

Returns a random text containing the set casing for letters and numbers, with with a length set by a numeric parameter.

The value for the casing parameter could be lowercase or uppercase.

Example: lowercase

Example: uppercase

${randomNumber()}

Returns a random number between 0 and 2147483647.

${randomNumber(lower limit, upper limit)}

Returns a random number between given the lower (including) and upper (excluding) limits.

${randomText()}

Returns a random 10-character long text containing uppercase and lowercase letters.

${randomText(length)}

Returns a random text containing uppercase and lowercase letters, with with a length set by a numeric parameter.

${randomText(length, casing)}

Returns a random text containing the set casing for letters, with with a length set by a numeric parameter.

The value for the casing parameter could be lowercase or uppercase.

Example: lowercase

Example: uppercase

Dates and times

${dateTime()}

Returns a pre-formatted date. The formatting depends on the language settings of the machine where JOSF is running on.

${dateTime(format)}

Returns a date time formatted by the given format. The formatting units are as follows;

  • y, or Y – for YEARS
  • M – for MONTHS (note the capitalized M)
  • d – for DAYS
  • H – for HOURS
  • m – for MINUTES (note the non-capitalized m)
  • s – for SECONDS

Example: date and time

In the example below, the format is dd-MM-YYYY HH:mm to generate the current date and time.

${dateTime(format, modifier)}

Returns a date time formatted by the given format plus a chronical modifier.

The syntax for a modifier is as follows. In this case, the modifier adds two days to the today’s date.

+2d
add or subtract ↲↓↳ the unit
the number

The formatting units are as follows;

  • y, or Y – for YEARS
  • M – for MONTHS (note the capitalized M)
  • d – for DAYS
  • H – for HOURS
  • m – for MINUTES (note the non-capitalized m)
  • s – for SECONDS

Example: the date of a week ago

Example: today, plus four hours

Preformatted data

${iban()}

Generates a unformatted eleven-check validated TEST IBAN code.

${iban(formatting)}

Generates a formatted eleven-check validated TEST IBAN code, by adding the F as the formatting toggle.

${iban(bank code)}

Generates a eleven-check validated unformatted IBAN code with a given bank code.

${iban(bank code, formatting)}

Generates a eleven-check validated formatted IBAN code with a given bank code, by adding the F as the formatting toggle.

${BSN()}

Returns a BSN-number that meets the criteria for a valid BSN-number.

A BSN-number is a personal identification number in the Netherlands, provided by the Dutch government.

${RRN()}

Returns a Belgian Rijksregisternummer that meets the criteria for a valid RRN-number.

A RRN-number is a personal identification number in Belgium, provided by the Belgian government.

${RRN(gender)}

Returns a Belgian Rijksregisternummer that meets the criteria for a valid RRN-number, including the gender toggle m or f.

A RRN-number is a personal identification number in Belgium, provided by the Belgian government.

${RRN(date of birth)}

Returns a Belgian Rijksregisternummer that meets the criteria for a valid RRN-number, including the date of birth option.

A RRN-number is a personal identification number in Belgium, provided by the Belgian government.

${RRN(gender, date of birth)}

Returns a Belgian Rijksregisternummer that meets the criteria for a valid RRN-number, including the date of birth option and the gender toggle m or f.

A RRN-number is a personal identification number in Belgium, provided by the Belgian government.

Collecting data

${getProjectPath()}

Returns the path of the project on your machine.

${secret(name)}

Returns a stored secret value, based on the given name. If the secret name is unknown or unset, or the project is still locked, this will return an error.

${getEnvVar(name)}

Returns an environment variable, which is stored on the local machine. Not to be confused with the environment variables set from JOSF’s preferences. If the environment variable is unknown or unset, this will return an error.

Modifying data

${substring(full text, from text)}

Returns a part of the given full text, from the given from text parameter onwards.

${substring(full text, from text, end text)}

Returns a part of the given full text, between the given from text parameter untill (excluding) the end text.

Two-factor authentication (2FA) / Multi-factor authentication (MFA)

Create TOTP token

${totp(secret)}

Generate a 6-digit Time-based One Time Password (TOTP) which can be used to sign into a application with 2FA.

How to retrieve a secret?

When enabling 2FA, you will receive a QR code that must be stored in your authenticator app, as it contains the secret key. By scanning the QR code with a QR-code scanner app/Google lens search, the secret is most of the time shown on your screen. If 2FA is already activated, some authenticator apps may allow you to retrieve the secret key, though this is often restricted due to security precautions.

Extra real world data generation

In this document