Table of Contents

Expression Generator

About

A expression generator is a column data generator that can generate data created from:

Howto

Syntax

columns:
  - name: columnName
    DataGenerator:
      type: expression
      ColumnParents: 
           - columnParentName1 # variable x
           - columnParentName2 # variable y
           - ...... # variable "z", "a", "b", "c", "d","e","f"
      expression: "javascriptExpression"  # See below for example
Mandatory Key Description
ColumnParents The column generator used in the expression
expression The expression in javascript where the parents columns maps by order to the following variables “x”, “y”, “z”, “a”, “b”, “c”, “d”,“e”, “f”

How to hide intermediate columns ?

When creating an expression generator, you may want to create columns that should not appear in the data generated. For this purpose, you can use the hidden property.

Example:

- name: columnToHide
  Hidden: true  # The column will not be added to the output.
  Description: An hidden column
  DataGenerator:
    type: entity

Snippet of expression

This section is showing snippet of expression (Javascript).

Time

x.getMonth()+1 // Month
var monthNames = ['Jan', 'Feb', 'Maa', 'Apr', 'Mei', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec']; 
monthNames[x.getMonth()]
x.getFullYear()

Email

Email String concatenation where:

x+'@'+y+'.'+z

Data Type

The below data type are supported:

Data Type
Integer
Float
Double
Numeric
Decimal
Date
Timestamp
Varchar