Generators and Utility Methods

DATPROF Runtime provides a wide range of generators for creating synthetic data in file generation templates. Generators can be grouped into the following categories:

  • Random Generators

  • Sequential Generators

  • Seed File Generators

  • Utility Methods

Random Generators

Generator

Example

Object ID

$dpf.objectId

Integer

$dpf.randomInteger

Integer (range)

$dpf.randomInteger.min(100).max(200)

Decimal

$dpf.randomDecimal

Decimal (range and scale)

$dpf.randomDecimal.min(100).max(200).scale(3)

Boolean

$dpf.randomBoolean

Random String

$dpf.randomString

Random String (custom length and alphabet)

$dpf.randomString.min(5).max(10).alphabet("ABCDEF0123456789")

Random Pick

$dpf.randomPick(1, 2, 3, 4, 5)

Weighted Pick

$dpf.weightedPick.weights(1, 1, 1).options( "A", "B", "C")

UUID

$dpf.uuid

Email Address

$dpf.email

Email Address (custom)

$dpf.email.local("pipo").domain("example.com")

Regular Expression

$dpf.regex("[A-Z]{5}[0-9]{4}[A-Z]")

Date and Time

Generator

Example

Date

$dpf.date

Date Range

$dpf.date.min("2000-01-01").max(2020,12,31)

Date Format

$dpf.date.format("dd/MM/yyyy")

Current Date

$dpf.date.now

Time

$dpf.time

Time Range

$dpf.time.min("08:00:00").max("18:00:00")

Time Format

$dpf.time.format("hh:mm a")

Current Time

$dpf.time.now

Timestamp

$dpf.timestamp

Timestamp Range

$dpf.timestamp.min("2000-01-01 00:00:00").max("2020-12-31 23:59:59")

Timestamp Format

$dpf.timestamp.format("dd/MM/yyyy HH:mm:ss")

Timestamp Timezone

$dpf.timestamp.timezone("America/New_York")

Current Timestamp

$dpf.timestamp.now

Financial Data

Generator

Example

Credit Card

$dpf.creditCard

Credit Card Issuer

$dpf.creditCard.issuers("MasterCard","Visa")

Sequential Generators

Sequential generators maintain state and typically return unique or incrementing values.

Generator

Example

BSN

$dpf.bsn

GBA

$dpf.gba

IBAN

$dpf.iban

IBAN (specific countries)

$dpf.iban.countries("DE","BE")

SSN

$dpf.ssn

Sequence Number

$dpf.sequence

Sequence (custom start and step)

$dpf.sequence.start(100).step(10)

Sequential generators should usually be stored in variables to preserve state during generation.

Seed File Generators

Seed file generators return values from predefined datasets.

Geography

Generator

Example

City

$dpf.city

City (country filter)

$dpf.city.countries("NL")

Country

$dpf.country

Country Code (ISO-2)

$dpf.countryCode2

Country Code (ISO-3)

$dpf.countryCode3

Person Data

Generator

Example

First Name

$dpf.firstName

First Name (language filter)

$dpf.firstName.languages("IT","ES","FR")

Female First Name

$dpf.firstNameFemale

Male First Name

$dpf.firstNameMale

Last Name

$dpf.lastName

Last Name (language filter)

$dpf.lastName.languages("IT","ES","FR")

Organizations and Products

Generator

Example

Brand

$dpf.brand

Company

$dpf.company

Job Title

$dpf.job

Job Title (language filter)

$dpf.job.languages("NL")

Miscellaneous

Generator

Example

Color

$dpf.color

Currency Code

$dpf.currencyCode

Currency Symbol

$dpf.currencySymbol

Dinosaur

$dpf.dinosaur

Genre

$dpf.genre

Rank

$dpf.rank

Rank (department filter)

$dpf.rank.departments("Airforce","Navy")

Street

$dpf.street

Street (language filter)

$dpf.street.languages("NL")

User Agent

$dpf.userAgent

Word

$dpf.word

Word (language filter)

$dpf.word.languages("US")

Utility Methods

Utility methods can be used to manipulate and format values within templates.

Comparison and Math

Function

Example

Equals

#if($dpf.utils.equals("Hello","Hello"))true#{else}false#end

Smallest Value

$dpf.utils.smallest(5,3,8)

Largest Value

$dpf.utils.largest(5,3,8)

Hash Code

$dpf.utils.hashCode("Hello, World!")

String Operations

Function

Example

Common Prefix

$dpf.utils.commonPrefix("Datprof","Data")

Common Suffix

$dpf.utils.commonSuffix("Datprof","Semiprof")

Repeat Text

$dpf.utils.repeat("123",3)

Truncate Text

$dpf.utils.truncate("1234567890",5,"...")

Pad Start

$dpf.utils.padStart("123",5,"~")

Pad End

$dpf.utils.padEnd("123",5,"~")

Escaping and Formatting

Function

Example

Escape XML Attribute

$dpf.utils.escapeXmlAttribute('This is a "quote" & an <angle>!')

Escape XML Content

$dpf.utils.escapeXmlContent('This is a "quote" & an <angle>!')

Escape HTML

$dpf.utils.escapeHtml('This is a "quote" & an <angle>!')

Double Quote

$dpf.utils.doubleQuote('Hello, World!')

Single Quote

$dpf.utils.singleQuote("Hello, World!")

Special Characters

Function

Example

New Line

Line1${dpf.utils.newline}Line2

Tab Character

Column1${dpf.utils.tab}Column2