Functions

Prev Next

This guide describes the functions that are available when you mask or generate data and also when you set up variables in your models.

General usage

How the functions are accessed depends on the activity that they are being used in.  In this section we show how the functions are accessed in the different data activities.  

The data activities are accessible through the Curiosity Platform. Select Activity Explorer (1), choose the appropriate directory (2) and choose the data activity (3).

You will then need to select the ruleset for the activity (whether it is masking or generation).

Masking

On the Masking ruleset, you will need to ensure the column list is visible (1), then click the Rules field (2) for the column, to show the Add button, then click Add (3) to add a rule.

In the Edit Masking Rule dialog, choose the Type, which corresponds to the Group (1), function (2) as listed in the later tables.  If there are any parameters, then these will need to be set (4).

Note that the name of the function when creating or editing  Masking rule is pre-pended with:

Masking.

for example:

Masking.FullAddress

Data Generation

On the data generation activity , you will need to ensure the column list is visible (1), then in the Rules field area (2) for the column, click the edit button to add or update a rule.

In the Generation function dialog, select the function from the functions section, filtering (1), as needed. The picking the function (2).  The function will be pre-populated with default parameters, where they are needed.

Note that the name of the function when creating or editing a generation rule is typically pre-pended with:

RandomHelper.Faker.Name.

for example:

RandomHelper.Faker.Name.FullAddress

Using functions in Variables

You can use functions when setting up variables.  For example on a model, where you set variables, for example on the variable list (1) or when setting the value for one linked to a task (2), then the edit button for the variable (3) will display the variable edit screen.

Which will allow you to set the value for the variable, which has a button to display the functions and data reference lists

Referencing the current value, using ^This^, and other columns

During data masking, you may need incorporate the current value of a field into the ‘masked’ value, rather than replacing it.  In order to do that, you can use the keyword:

^This^

Note that it is case sensitive (^this^ will not work, as the interpreter will look for a column called this)

For example, if you needed to change the case of the current contents of a field, you could use:

"^This^".toLower()

to change the current field to be lower case

You can also reference the value of another column, in a similar manner.  For example if you have a column called lastname, then:

"^lastname^".toUpper()

would set the value of a field to be that of lastname in uppercase.

Function lists

These are listed by group

For those with parameters, the descriptions have been listed.

Address

Function Name

Description

Parameters

Parameter Description

Example outputs

BuildingNumber

A building number.

23

CardinalDirection

A cardinal direction, for example: North, South, E, W.

useAbbreviation

set to True for single letter abbreviation

useAbbreviation=False

West

useAbbreviation=True

S

City

A city name, for example: Kesslerton

Port Hardyberg

CityPrefix

A city prefix, for example North, Lake

New

CitySuffix

A city suffix, for example: ton, bury.

ville

Country

A country.

Canada

CountryCode

A 2 character ISO 3166-1 country code, for example: CN

IR

CountryCode - with parameter

An ISO 3166-1 country code

format

A dropdown list of the code formats:

  • Iso3166Format.Alpha2

  • Iso3166Format.Alpha3

Iso3166Format.Alpha2

County

A county, for example: Avon

Buckinghamshire

Commerce

Function Name

Description

Parameter

Parameter description

Example outputs

Color

An aesthetically pleasing color near the base RGB.

salmon

Department

A commerce department.

max

The number of names to include in the department

max: 2, returnMax: True

‘IT & Sports’

max:5, returnMax: False

‘Gardening, Lights and Magic’

returnMax

The number of names is fixed or max

Ean13

A EAN-13 barcode number.

4835920318098

Ean8

A EAN-8 barcode number.

59699002

Price

A product price.

min

minimum price

£7.74

max

maximum price

decimals

Number of decimals for the price

symbol

currency symbol

Product

A product name

Gloves

ProductAdjective

A product adjective

Small

ProductMaterial

A product material

Steel

ProductName

A product name

Unbranded Concrete Hat

Company

Function Name

Description

Parameter

Parameter description

Example outputs

Bs

A company phrase

utilize ubiquitous experiences

CatchPhrase

A company catch phrase

Secured asynchronous paradigm

CompanyName

A company name

Purdy and Sons

CompanyName - with format

A company name based on the given format

format

The format for the company name (can reference other functions), for example:

"{{name.FirstName}} {{name.JobDescriptor}}"

"{{name.FirstName}}’s company"

"{{name.FirstName}} and {{name.FirstName}}"

Peter’s Company

CompanySuffix

Get a company suffix, for example:  Inc, LLC

Group

Database

Function Name

Description

Parameter

Parameter description

Example outputs

Collation

A database collation type

utf8_unicode_ci

Column

A database column name

updatedAt

Engine

A database storage engine

MEMORY

Type

A database column type

bigint

Date

Note that the dates need to be in date/time format.  One way to generate these would be:

New System.DateTime(2014, 1, 30)

Note that you can format the output using the ToString function, for example:

.ToString("yyyy-MM-dd HH:mm:ss.fff")

Function Name

Description

Parameter

Parameter description

Example outputs

Between

A date/time between start and end

start

Start date in date/time format  

7/10/2027 11:09:18 PM

end

End time in date/time format

Future

A future date/time between refDate and yearsToGoForward

yearsToGoForward

Years to go forward from refDate. Default is 1 year

7/11/2024 1:19:10 PM

refDate

Start date  in date/time format.

Default is System.DateTime.Now

Month

A month

abbreviation

Set to True to use the abbreviation

May

useContext

Always False

Past

A past date/time between refDate and yearsToGoBack

yearsToGoBack

Years to go back from refDate. Default is 1 year

7/14/2024 11:04:01 PM

refDate

The date to start calculations. Default is System.DateTime.Now

Recent

A date/time within the last few days

days

Number of days to go back

2001-04-06 12:22:13.480

refDate

Start date. Default is System.DateTime.Now

Soon

A date/time that will happen soon

days

Number of days to go forward

6/17/2014 2:57:53 AM

refDate

The date to start calculations. Default is System.DateTimeOffset.Now

Weekday

A random weekday

abbreviation

Set to True to use the abbreviation

Wednesday

Sat

useContext

Always False

Finance

Function Name

Description

Parameter

Parameter description

Example outputs

Account

An account number. Default length is 6 digits

length

length of account number

63635993

AccountName

An account name. Like 'savings', 'checking', 'Home Loan' etc..

Checking Account

Amount

Get a random amount. Default 0 - 1000

min

min amount

1.19

max

max amount

decimals

decimal places - default 2

Bic

A BIC code

RWUAIDC1

BitcoinAddress

Generate a random bitcoin address

1C6MPwNeEdXZTYb7jJqz1F9HBynVSvpGxi

CreditCardCvv

A 3 digit card cvv value

420

CreditCardNumber

A credit card number with valid Luhn checksum

6771732192586718066

CreditCardNumber - with type parameter

A credit card number for the designated provider, with valid Luhn checksum

provider

Supported types are "American Express", amex, visa, master, discover, dinersclub. If not provided a random card type will be chosen

3734-735616-44038

Currency

CurrencyCode

A random currency

GBP

EthereumAddress

Spins text and selects one of the possible option

0x52cdb2eb76b78c0e5dbcdc9dc382839fa99c0af8

Iban

Get random datetime value

formatted

If True, the IBAN contains formatting spaces

TL41 6857 0340 0212 4530 069

GB78RTKJ88008738006032

Country Code (optional)

Iban is generated for that country

RoutingNumber

A ABA routing number with a valid check digit (used in transaction routing in US)

443080933

TransactionType

Get a transaction type: 'deposit', 'withdrawal', 'payment', or 'invoice'.

invoice

General

Function Name

Description

Parameter

Parameter description

Example outputs

EvaluateExpression

Returns the result of evaluating a C# expression

c# expression

a c# expression, for example:  "DateTime.Now.ToShortTimeString()"

2:12 PM

FreeFormatValue

Return the value given in the parameter

Not available for Data Generation

valueToReturn

This could be a fixed value, a column reference, an expression.  For example you can reference the value in another column

^firstname^

would reference the firstname column

ListLookup

Lookup a value from a seedlist

Not available in Data Generation

ListName

The name of the seedlist

SelectionType

Drop-down list of the types of lookups available to get data:

Random - choose values randomly from the list

Sequential - take values sequentially

Hash - This selects a row based on the has value of the replaced data, so that the value value is always replaced with the same masked value.

ColumnToReturn

For multi-column seedlists the column id from the list to use, defaults to 1

ColumnToHash

For a Hash selection type the name of the column, in the table being masked, to hash. Defaults to the column being masked.  Only used where the selectionType is Hash

SQLfunction

SQL function

An SQL update statement, for example a fixed value, SQL function or stored procedure.

Hacker

Function Name

Description

Parameter

Parameter description

Example outputs

Abbreviation

An abbreviation

USB

Adjective

An adjective

auxiliary

IngVerb

An -ing verb

compressing

Noun

A noun

feed

Phrase

A phrase

generating the driver won't do anything, we need to transmit the auxiliary USB driver!

Verb

A verb

override

Hashids

Function Name

Description

Parameter

Parameter description

Example outputs

DecodeHex

Decode a hash into a hex string

Hex

string to be decoded, for example “KPRJ”

2AB1

EncodeHex

Encodes a hex string

hex

string to be encoded, for example “2AB1”

KPRJ

Internet

Function Name

Description

Parameter

Parameter description

Example outputs

Avatar

A legitimate Internet URL avatar from twitter accounts

https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/1122.jpg

DomainName

A domain name

alexie.biz

DomainSuffix

A domain name suffix like .com, .net, .org

org

DomainWord

A domain word used for domain names

damien

Email

A random email address

Note if individual parameters are left blank, random ones will be used

firstName

Always uses this first name

Hubert26@gmail.com

lastName

Sometimes used depending on randomness

provider

Always use this provider

uniqueSuffix

This parameter is appended to the email account just before the @ symbol

ExampleEmail

An example email with @example.com

Note if individual parameters are left blank, random ones will be used

firstName

first name of the user

Zack57@example.org

lastName

last name of the user

Ip

A random IP address

113.247.44.184

Ipv6

Generates a random IPv6 address

e179:4062:e5cc:914e:e0bf:535c:a47c:b74

Mac

A random mac address

separator

Separator to use, default is : if none is specified

32-76-27-02-b0-19

Password

A random password

length

Length of the password

(10, false, "(?=.*?[0-9])", "Quill"):

Quill88073

(10, true, , "Bi"):

Bieioeeueu

memorable

A memorable password (ie: all lower case)

regexPattern

Regex pattern that the password should follow

prefix

Password prefix

Protocol

A random protocol. HTTP or HTTPS.

https

Url

A random URL

http://shanny.com

UrlWithPath

A random URL with random path

protocol

Protocol part of the URL, random if null

https://google/incredible-granite-hat

http://giuseppe.com/bandwidth

domain

Domain part of the URL, random if null

UserAgent

A random user agent

Mozilla/5.0 (Windows; U; Windows NT 5.3) AppleWebKit/531.2.1 (KHTML, like Gecko) Chrome/26.0.865.0 Safari/531.2.1

UserName

A username

Note if individual parameters are left blank, random ones will be used

firstName

first name of the user

Mark.Elliot

lastName

last name of the user (sometimes used)

Lorem

Function Name

Description

Parameter

Parameter description

Example outputs

Letter

A character letter

num

Number of characters to return

tornmitmub

Lines

Lines of lorem

lineCount

The number of lines

Minus modi recusandae at et quia qui id..Amet dolor optio.

separator

Separator to use, default is none

Paragraph

A paragraph

min

The minimum number of sentences in the paragraph. The final number of sentences returned in the paragraph is bound between [min, min + 3], inclusive

Est eum autem est adipisci et mollitia. Praesentium voluptate saepe ipsum ut. Alias aut dolor voluptas magni sint modi voluptates quam ad.

Paragraphs - fixed number

A specified number of paragraphs

count

Number of paragraphs

Aliquam facere dolores quia corporis. Ipsum incidunt voluptatem facere impedit. Sunt ratione totam provident. :: Inventore distinctio dolorem at non qui nobis eius illo magni. Animi tempore eos laboriosam et placeat. Nobis sint magnam totam deserunt. Vel facilis quos consequuntur.

separator

Separator to use. Default is \n\n

Paragraphs - random number

A specified number of paragraphs

min

Minimum number of paragraphs

Quis voluptatem dolorum quasi quod. Harum odit quo tempore laudantium quia quis nobis ipsa quia. Minus non similique cumque voluptatem ipsum sed. Provident et quis quod voluptate sint. Qui quo tempora labore quo laboriosam sequi enim.

max

Maximum number of paragraphs

separator

Separator to use. Default is \n\n

Sentence - with parameters

A random sentence of specific number of words

(random number if no parameters specified)

wordCount

Get a sentence with wordCount words. Defaults between 3 and 10

Blanditiis recusandae aspernatur repellendus rerum totam dolore aut officiis tenetur.

range

Add anywhere between 0 to 'range' additional words to wordCount. Default is 0.

Sentences

Some sentences

sentenceCount

The number of sentences

Illo nihil porro.:_:Omnis odio excepturi.:_:Est alias qui nostrum occaecati esse fugiat.

separator

Separator to use. Default is \n

Slug

Slugify lorem words

wordcount

Word count. Default is 3

eaque-dignissimos-adipisci

Text

Random text

Deleniti architecto animi deserunt placeat qui nobis. Sequi ut eligendi voluptatum animi accusamus illum eligendi ut eum.

Name

Function Name

Description

Parameter

Parameter description

Example outputs

FullName

A full name

(random, if no parameter given)

gender

Gender

Antonia Kunde

FirstName

A first name.

(random, if no parameter given)

gender

For locales that support Gender naming

Juan

JobArea

A job area expertise

Operations

JobDescriptor

A job description

Legacy

JobTitle

A random job title

Principal Applications Designer

JobType

A type of job

Specialist

LastName

A last name.

(random, if no parameter given)

gender

For locales that support Gender naming

Schaden

Suffix

A random suffix for a name

PhD

Phone

Function Name

Description

Parameter

Parameter description

Example outputs

PhoneNumber

Returns a phone number.

format

Format of phone number. Replaces # characters with numbers. for example: '###-###-####'. Random format if none specified.

5364 0192937

PhoneNumberFormat

A phone number based on locale phone number formats

phoneFormatsArrayIndex

index of the locale phone number format (set to 0 if no value given)

373-771-8342

Random

Function Name

Description

Parameter

Parameter description

Example outputs

AlphaNumeric

A set of alpha numeric characters 0-9, a-z

length

Fixed String length to return

w9a1st

Bool

A boolean

False

Bool - weighted

A boolean (weighted)

weight

probability of getting a True

True

Byte

A byte between 0 and 255

min

Min value, default 0

60

max

Max value, default 255

ClampString

Clamps the length of a String filling between min and max characters. Shorter strings are appended with random characters up to the minimum length. Longer string are truncated at maximum characters. If the String would end with whitespace, it is replaced with a random characters

str

input String to clamp

frQQ

min

minimum String length

max

maximum String length

GetRandomDateTime

A datetime value. Note the to and from parameters are required

to

Maximum datetime value in format yyyy-MM-dd

12/3/2023 7:40:52 AM

from

Minimum datetime value in format yyyy-MM-dd

Decimal

A decimal

min

Minimum, default 0.0

1.7935888307604890

max

Maximum, default 1.0

Double

A double

min

Minimum, default 0.0

1.77063313008781

max

Maximum, default 1.0

Even

A even number

min

Lower bound, inclusive

102

max

Upper bound, inclusive

Float

A float

min

Minimum, default 0.0

6.024675

max

Maximum, default 1.0

FormattedString

A String value based on provided format

format

String format  where # = Number, ? = Letter, * = Number or Letter. For example: ###-### or ##? ???

YQY16G0VQE

GetGuid

A GUID

cf6cae73-3b67-4dea-b826-a7bc3d000358

Hash

A hex hash. Default 40 characters, aka SHA-1

length

The length of the hash String

0b5455b2fb

upperCase

True means return the hex string with uppercase characters

Hexadecimal

A hexadecimal String

length

Fixed String length to return

0xfd04f12a45

prefix

Prefix returned String with. default value 0x

Int

An integer value between MinValue and MaxValue

minValue

Min value, default int32.MinValue

10

maxValue

Min value, default int32.MaxValue

Long

A long value between MinValue and MaxValue

min

Min value, default long.MinValue

2016

max

Max value, default long.MaxValue

Odd

Returns a random odd number

min

Lower bound, inclusive

385

max

Upper bound, inclusive

Parse

parse a handle bar expression and returns a String value

expression

format like [[name.suffix]] [[name.lastName]] [[name.firstName]] OR {{name.lastName}}, {{name.firstName}} {{name.suffix}} or {{name.firstname(Female)}}, {{name.firstname(Male)}}

Bob

PickFromCSV

Selects one random value from list of values in CSV String

csv

separated list of values, for example: 10,20,30,40,50

40

separator

separator character, for example: ,

Replace

Replaces symbols with numbers and letters.

Not available for Data Generation

format

String format where  # = number, ? = letter, * = number or letter. For example: ###???* Letters are uppercase

283QED4

SByte

Generate a random sbyte between -128 and 127

min

Min value, default -128

4

max

Max value, default 127

SequenceInt

Next integer value in sequence (Sequence is stored internally in VIP). It returns the next value if the same VIP executor is used and resets to 0 when the VIP Executor restarts.

Not available for Data Generation

sequenceName

Name of the sequence

3

startWith

Start value of sequence

SequenceLong

Next long value in sequence (Sequence is stored internally in VIP). It returns the next value if the same VIP executor is used and resets to 0 when the VIP Executor restarts.

Not available for Data Generation

sequenceName

Name of the sequence

5

startWith

Start value of sequence

Short

Generate a random short between MinValue and MaxValue

min

Min value, default MinValue (-32768)

-1

max

Max value, default MaxValue (32767)

SpinText

Spins text and selects one of the possible option.

Alternate values are separated by | and enclosed in {}

content

Content to be spun.  For example:

{The {{quick|slow}|{fast|swimming}|speedy} brown fox {jumped|leaped|hopped} {over|right over|over the top of} the {lazy|sluggish|care-free|relaxing} dog.}

The swimming brown fox hopped over the lazy dog.

String2

A string of characters drawing characters from a given list

minLength

Minimum length

qstyh

maxLength

Maximum length

chars

The pool of characters to draw from. The returned String may contain repeat characters from the pool default value (abcdefghijklmnopqrstuvwxyz)

String2 - fixed length

A string of characters with a specific length drawing characters from a given list

length

The length of the String to return

afcvng

chars

The pool of characters to draw from. The returned String may contain repeat characters from the pool default value (abcdefghijklmnopqrstuvwxyz)

Uuid

Get a random unique GUID

cfa8be05-280f-6700-f663-1d31b3873494

Word

Returns a single word or phrase in English

payment

Words

Gets some random words and phrases in English

count

Number of words to include

Ranch PCI JBOD payment Cambridgeshire

Rant

Function Name

Description

Parameter

Parameter description

Example outputs

Review

A user review

product

Product name to generate review for

My co-worker Ali has one of these. He says it looks towering.

SSN

Function Name

Description

Parameter

Parameter description

Example outputs

CNPJ.Generate

A valid CNPJ number

14611720109612

CPF.Generate

A valid CNPJ number

80506346552

SSN

A social security number

93744303567167

SwedishSSN

Generate a random Swedish social security number

date

date the SSN is based on

200606240034

seqNo

sequence number to use

System

Function Name

Description

Parameter

Parameter description

Example outputs

AndroidId

GCM Registration ID

APA91CCh6Ltl6yhAUgZso7Nc3aF9_eWtRPFBDBCDx5rQOW2_5I4k5oNs6hPrYthVR0vjVIZjGnXiJZq97G4k9Cnt2cvnNaG4Rx-OrL5pKNGKtvK8SGkjpYMgF1hIeCyvJTtc-EKoAHCpXF0Aumx6ToHUNL8qvqb7fa1C1yaeYXKKnok_1IfT5sE

ApplePushToken

Apple push token

5296375e2772ca68e242faf86626c250c8a671eba083e385924ac4aa300c5e1f

BlackBerryPin

A BlackBerry device PIN

2653ff1d

CommonFileExt

A commonly used file extension

pdf

CommonFileName

A commonly used file name. If no file extension is specified a random one will be used

ext

File name extension

cyan_input.mp3

CommonFileType

A commonly used file type

video

DirectoryPath

A random directory path (Unix).

/opt/include

Exception

A system exception

Not available for Data Generation

System.BadImageFormatException: emulation withdrawal revolutionize

File name: 'gold'

  at Bogus.DataSets.System.Exception()

FileExt

Gets a random extension for the given mime type

Not available for Data Generation

mimeType

mime type to get the file extension for

pdf

FileName

A file name.  If no file extension is specified a random one will be used

ext

File name extension

savings_account_instruction_set.flo

FilePath

A file path (Unix)

/home/user/haptic.stw

FileType

A commonly used file type

multipart

MimeType

A mime type

application/cybercash

Semver

A semver version String

0.4.8

Version

A version number string

Not available for Data Generation

1.2.6.5

Lists

These functions retrieve values from a list based on a selection done in the List query parameters

For example:

=RESOLVELISTCOUNT("listId=2842&where=(transaction_type=='atm')&col=1",1,-1)

=RESOLVELIST("listId=2842&where=(transaction_type=='atm')&col=1","NotFound","ResolveError")

The list select is the first parameter, followed by two values that are used if the select fails (either not found or fails to resolve).  

These are not for use when masking data, only for use in model variables.

Function Name

Description

Parameter

Parameter description

Example outputs

RESOLVELIST

Resolves values from a list.

List query

List lookup

RESOLVELISTCOUNT

Resolves values from a list.

List query

List lookup