Data Generation Functions

Data Generation Functions

Generation functions create data in an expression.

Numerical functions

RANGE(a,b[,precision]): number in a range

This function returns number randomly drawn between a and b. The precision of the generated number can be specified as the third argument, if not, number are integers.

DEC(n [,m[,sep]]): numbers generation

This function returns a number whose integer part contains n digits, decimal part contains m digits and these two parts are separated by sep. The parameters m and sep are optional, default values are '0' and '.'. Examples: DEC(5) returns 44578, DEC(2,2) returns 55.29, DEC(2,2,%) returns 55%29

SUMSEQ(sum,nbval,disp,prec) : Sequence of number

This function produces a sequence of nbval float number whose sum is equals to sum. each generated value is randomly selected around the mean of sump/nbval with a dispersion of +/- prec %. Produced values are rounded to prec decimals.

 List functions

RANDLIST(a,b,...,x): random item in a list

This function returns a value randomly drawn in the list a,b,...,x. Note that element "a" can occur more than "b" and, thus, "a" can have a higher probability than "b" to be drawn.

If the last value in the sequence is the special value __selfExpandParameters then each parameter of the function is tislef analyzed as a sequence of parameter.

For example, if you have a variable named X with the value "a,b,c,d" then calling RANDLIST(GET(X)) will always return the value of X since the function RANDLIST found a single parameter. But if you call RANDLIST(GET(X),"__selfExpandParameters") then the function will analyse the value of X as the list of values and will produce a, or b, etc.

ITERLIST(name,a,b,...,x): iterator over the items of a list

This function returns each value in the list a,b,...,x one after the other. First time the function is called it returns the first value in the list, then second time the returned value will be the second and so on. When reaching the end of the list, the function will restart at the beginning (looping).

The first parameter is the name of the iteration allowing the generation engine to remember the current status of the iteration whereever it is called from.

ITERWLIST(name,a,wa,b,wb,...,z,wz) : iterator over weighted items of a list

This is a variation of the ITERLIST function where wi is the numer of times i will be provided by the function.

ITERFILE(name,fileName,n,regex) : iterator over the lines of a user's worskpace's text file.

This function iterates over the lines of a text file located either in the Data or Output folder of the user's workspace. When reaching the end of the file, the function will loop back to the beginning. name is the unique name of the iterator, n is the number of header lines to skip and regexp is a regular expression that should match any line to skip from the input file.

Characters based functions

ALPHA(n): letters generation

This function returns a word of size n in lowercase, using letters from a to z.

WORD(n,alphabet): words generation

This function returns a word of size n, using letters from the specified alphabet. Example: WORD(5,1~@abcd) can return "~~da1"

Time Functions

TIMEOFF(time,duration[,format]): Time offset generation

This function returns a time computed from a basetime "time" and an offset duration. The base time must be given with the format YYYY-MM-DD hh:mm:ss or using the keywords 'today' or 'now'. The duration is in the format "[d] HH:MM:SS" where d stands for the number of days. The output format of the time is given by parameter "format" (using %H for hours, %M for minutes and %S for seconds, %Y for year, %d for day and %m for month).


  • TIMEOFF("2009-01-01 12:15:00","00:02:03","%H:%M:%S") returns "12:17:03".
  • TIMEOFF("today","1 00:00:00") returns tomorrow timestamp

TIMEDIFF(timestamp1,timestamp2[,format]) : Time range duration

This function returns a duration between two timestamp. The result is formated usin the provided template in third parameter, or "%Y/%m/%d %H:%M:%s" if not third parameter is provided. Timestamps can be 'now' or 'today'.


  • TIMEDIFF("2014/04/01 06:30:03","2014/04/01 06:33:00","%S") returns the elapsed time in seconds

TIMERANGE(timestamp1,timestamp2[,format]) : Timestamp from a range

This function pick-up a timestamp between timestamp1 and timestamp2 and use the specified format if any is given.

CSV record processing

COLUMN(strval,cols,sep[,type[,outsep]]): CSV field extraction

The COLUMN function extracts the columns numbered by cols (first column has index 1) from the strval string. This parameter must be a CSV record whose field separator is "sep". When multiple columns are specified the default is to use the input parameter for building the extracted values. Othewise you can specify the outsep parameter.


  • COLUMN("hello:world:!","2",":") returns world.
  • COLUMN("A\,B\,C","3 2","\,") returns C,B
  • COLUMN("A\,B\,C","3 2","\,","STRING",";") returns C;B
  • COLUMN("A:B;C;D:E","4","[;:]",REGEXP) returns D

The fourth optional parameter gives the type of the separator : STRING or REGEXP. Default is STRING

NBCOL(strval,sep): CSV field size

This function returns the number of fields of strval string. This parameter must be a CSV record whose field separator is "sep". Example: NBCOL(hello:world:!,:) returns 3.

Add comment

Security code