Visier Business Rule Language (VBRL)

Use the Visier Business Rule Language to transform data in Visier.

Overview

Use the Visier Business Rules Language (VBRL) to transform data in Visier. VBRL formulas are written as a single expression that transform records.

Basic syntax

Define rules for adding, updating, and deleting data based on specific triggers.

when

Triggers an action.


add

Adds an event.


update

Updates property values.


delete

Deletes events.

Note:

  • You can perform multiple deletes by adding delete before each expression where each expression returns a single event.
  • At most, each delete can delete one event.


match

Performs actions when values meet the specified criteria.


effectiveDate

Sets the date for events. Updating effectiveDate for existing events creates a copy of the event with an updated effectiveDate. If you'd like to remove the event with the previous effectiveDate property value, you can use the delete syntax.


if

Starts a conditional statement.


else

Provides the default case in a conditional statement.


forEach

Updates multiple events that occur at the same time.


call

Invokes predefined rule functions.


tenantStartDate

Returns the start date for your tenant.


Event functions

Filter events based on occurring changes, event types, property values, and the position of the event in the context of the event stream. For example, adding a new "Promotion" event when the "Title" property changes.

any

Triggers on any event.


profileChangeEvent

Returns any profile change events.


changeIn

Triggers on events with changes to a specific property.


changeInAny

Triggers on events with changes to any properties in a collection.


filter

Returns events that meet the specified filter criteria.


andFilter

Combines two filters.


orFilter

Returns true if either filter is true, otherwise returns false.


notFilter

Returns any event that does not meet the filter criteria.


conceptionEvent

Triggers on conception events.


terminationEvent

Triggers on termination events.


regularEvent

Triggers on regular events.


current

Returns the most recent event that meets the specified filter criteria.


next

Returns the next event that meets the specified filter criteria.


previous

Returns the previous event that meets the specified filter criteria.


first

Returns the first event that meets the specified filter criteria.


last

Returns the latest event that meets the specified filter criteria.


all

Returns all events in the stream that meet the specified filter criteria.


sameDateAs

Returns true when the event time is equal to the event time returned by an event, otherwise returns false.


Value functions

Get property values from specific events.

valueOf

Returns the value of the property based on an event.


dateOf

Returns the date associated with an event.


currentValueOf

Returns the value of the property from the most recent event. This is shorthand for valueOf(property, current(changeIn(property))).


nextValueOf

Returns the value of the property from the next event. This is shorthand for valueOf(property, next(changeIn(property))).


previousValueOf

Returns the value of the property from the previous event. This is shorthand for valueOf(property, previous(changeIn(property))).


firstValueOf

Returns the value of the property from the first event. This is shorthand for valueOf(property, first(changeIn(property))).


lastValueOf

Returns the value of the property from the last event. This is shorthand for valueOf(property, last(changeIn(property))).


valueAsOf

Returns the value of a property at a specific date.


atLeastOnce

Returns true if the property has changed at least once, otherwise returns false.


containedIn

Compares a value to a collection of values and returns true if there is a match.


Aggregation functions

Aggregate property values in your business rules. For example, min, max, sum, and average.

minAggregation

Returns the minimum value for property at the point in time when the filter is true. The minimum is reset when resetTrigger is triggered.

Note: Both property and filter should be operating on the same event, and must be functions that work with one event at a time. For example valueOf(Employee.Salary) is an acceptable property, since it is only concerned with the value of the Salary property of a single event. However, valueOf(previous(Employee.Salary)) is not an acceptable property, since it requires multiple events to determine its value.


maxAggregation

Returns the maximum value for property at the point in time when the filter is true. The maximum is reset when the resetTrigger is triggered.

Note: Both property and filter should be operating on the same event, and must be functions that work with one event at a time. For example valueOf(Employee.Salary) is an acceptable property, since it is only concerned with the value of the Salary property of a single event. However, valueOf(previous(Employee.Salary)) is not an acceptable property, since it requires multiple events to determine its value.


sumAggregation

Returns the sum value for property at the point in time when the filter is true. The sum is reset when the resetTrigger is triggered.

Note: Both property and filter should be operating on the same event, and must be functions that work with one event at a time. For example valueOf(Employee.Salary) is an acceptable property, since it is only concerned with the value of the Salary property of a single event. However, valueOf(previous(Employee.Salary)) is not an acceptable property, since it requires multiple events to determine its value.


averageAggregation

Returns the average value for property at the point in time when the filter is true. The average is reset when the resetTrigger is triggered.

Note: Both property and filter should be operating on the same event, and must be functions that work with one event at a time. For example valueOf(Employee.Salary) is an acceptable property, since it is only concerned with the value of the Salary property of a single event. However, valueOf(previous(Employee.Salary)) is not an acceptable property, since it requires multiple events to determine its value.


Date functions

Define, format, and shift dates, calculate the difference between dates, and get the start and end of a date interval. For example, day, week, month, and year.

date

Returns a date object.


formatDate

Returns a date string in the specified format.


getDay

Returns the day from a date as an integer.


getMonth

Returns the month from a date as an integer.


getYear

Returns the year from a date as an integer.


getCustomCalendarDay

Returns the day from a date as an integer based on the configured custom calendar.


getCustomCalendarMonth

Returns the month from a date as an integer based on the configured custom calendar.


getCustomCalendarYear

Returns the year from a date as an integer based on the configured custom calendar.


firstOfMonth

Returns a date value shifted to the first day of calendar month.


firstOfYear

Returns a date value shifted to the first day of calendar year.


firstOfCustomCalendarMonth

Returns a date value shifted to the first day of the custom calendar month.


firstOfCustomCalendarYear

Returns a date value shifted to the first day of the custom calendar year.


lastOfMonth

Returns a date value shifted to the last day of the month.


lastOfYear

Returns a date value shifted to the last day of the year.


lastOfCustomCalendarMonth

Returns a date value shifted to the last day of the custom calendar month.


lastOfCustomCalendarYear

Returns a date value shifted to the last day of the custom calendar year.


millisBetween

Returns the number of milliseconds between two dates. This function returns a negative value if the first argument is less than the second argument.


secondsBetween

Returns the number of seconds between two dates. This function returns a negative value if the first argument is less than the second argument.


minutesBetween

Returns the number of minutes between two dates. This function returns a negative value if the first argument is less than the second argument.


hoursBetween

Returns the number of hours between two dates. This function returns a negative value if the first argument is less than the second argument.


daysBetween

Returns the number of days between two dates. This function returns a negative value if the first argument is less than the second argument.


monthsBetween

Returns the number of months between two dates. This function returns a negative value if the first argument is less than the second argument.


yearsBetween

Returns the number of years between two dates. This function returns a negative value if the first argument is less than the second argument.


shiftMillis

Returns a date shifted by a number of milliseconds. You can specify a positive or negative value for the number of milliseconds.


shiftSeconds

Returns a date shifted by a number of seconds. You can specify a positive or negative value for the number of seconds.


shiftMinutes

Returns a date shifted by a number of minutes. You can specify a positive or negative value for the number of minutes.


shiftHours

Returns a date shifted by a number of hours. You can specify a positive or negative value for the number of hours.


shiftDays

Returns a date shifted by a number of days. You can specify a positive or negative value for the number of days.


shiftMonths

Returns a date shifted by a number of months. You can specify a positive or negative value for the number of months.


shiftYears

Returns a date shifted by a number of years. You can specify a positive or negative value for the number of years.


startOf

Returns the start of the specified date or time interval.


endOf

Returns the end of the specified date or time interval.


day

Returns a day time interval when using startOf or endOf.


week

Returns a week time interval when using startOf or endOf.


month

Returns a month time interval when using startOf or endOf.


year

Returns a year time interval when using startOf or endOf.


Comparison operators

Compare values.

=

Compares two values and determines whether they are equal.


!=

Compares two values and determines whether they are not equal.


>

Compares two values and determines whether the left value is greater than the right value.


<

Compares two values and determines whether the left value is less than the right value.


>=

Compares two values and determines whether the left value is greater than or equal to the right value.


<=

Compares two values and determines whether the left value is less than or equal to the right value.


Logical operators

Compare expressions and return a Boolean value.

and

Compares two expressions and returns true if both are true. This is interchangeable with &&.


&&

Compares two expressions and returns true if both are true. This is interchangeable with and.


or

Compares two expressions and returns true if either is true. This is interchangeable with ||.


||

Compares two expressions and returns true if either is true. This is interchangeable with or.


not

Compares two expressions and returns true if not true. This is interchangeable with !.


!

Compares two expressions and returns true if not true. This is interchangeable with not.


String functions

Alters strings by concatenating, changing capitalization, and more.

+

Concatenates strings.


sha256

Computes the SHA-256 hash of a given string, returning the hash as a hexadecimal string.


toLowerCase

Converts a string to lower case.


toUpperCase

Converts a string to upper case.


trimWhitespace

Removes white space from a string.


stringLeft

Returns a subset of characters from the left-side of a string.


stringRight

Returns a subset of characters from the right-side of a string.


stringDropLeft

Removes characters from the start of a string.


stringDropRight

Removes characters from the end of a string.


stringSubstitute

Searches and replaces in a string.


stringReplace

Replaces a substring.


regexCapture

Returns the first capture group if there is a match. Otherwise, returns none.


regexMatch

Returns the part of a string value that matches the specified regular expression. Otherwise, returns none.


regexSubstitute

Searches and replaces using regular expressions.


indexOf

Returns the starting index of the first occurrence of searchString found in valueString. Optionally, you can specify a starting index if you'd like to start the search at a position greater than 0.


lastIndexOf

Returns the starting index of the last occurrence of searchString found in valueString. Optionally, you can specify a starting index if you'd like to start the search at a position greater than 0.


length

Returns the length of a string as an integer.


capitalizeAll

Converts the first character of all words in a string to upper case and other characters to lower case.


capitalizeFirstChar

Converts the first character in a string to upper case. This does not modify other characters.


Math functions

Get the minimum, maximum, modulus, absolute, floor, ceiling, and rounded numbers.

min

Returns the lesser of the two values. Both values should be of the same type.


max

Returns the greater of two values. Both values should be of the same type.


mod

Returns the modulus of the two values.


abs

Returns the absolute value.


floor

Returns the floor for a number.


ceiling

Returns the ceiling of a number.


round

Returns the rounded value.


Predefined rule functions

Special functions that perform operations that go beyond what other functions can do.

groupAndPick

Returns a single event out of a set of events and deletes all other events in the set. This function is useful for removing duplicate events, resolving inconsistencies between data sources, and handling multiple changes happening on the same date.


addValidRanges

Adds a valid range for profile change events that meet the following criteria:

  • The property does not have a valid range defined.
  • There is another profile change event with the same date and a valid range defined.

This function updates invalid ranges with a valid range pulled from a profile change event that shares the same date and has a valid range defined.

By default, the criteria for an invalid range is a value that equals to none. You can override this behavior by specifying a filter and adding your own criteria for what should be considered to be an invalid range.


augmentingMapping

Augments a mapping using a lookup mapping object.


backfillChanges

Updates the initial value assignment of the specified properties to happen at some initial date.


changeDates

Adds an event with a specified value and event date derived from the value of another date property. By default, this function creates one event per date property specified in the datePropertiesCollection argument, based on the latest event record. You can change this behavior and create an event for every date record by setting a true value for the optional changeAllBoolean argument.


consolidateRegularEvents

Consolidates events with the same date into one event.


createSubjectMember

Inserts a new subjectID and related properties.

Note: You cannot use a subjectID that already exists in your data.


createProfilesForCTEvents

Creates conception and termination events from actual conception and termination events. This is useful for dealing with non-snapshot data which is necessary for the CT System Rule.


dropProfileIfCondition

Deletes all events for the current subject where the condition provided is true.


eventsToPropertyChanges

Converts the values of properties on events into property changes in the main subject profile. These changes take place at the same time as the event used to generate them.


filterSelfReference

Removes Profile Change Events where the provided reference property creates a self-reference loop.


ignorePropertyChangesDuringInactivity

Updates isolated inactive profiles with a new sourceID so that subsequent rules can ignore them.


moveEventsToMatchFoundEventDate

Matches an event based on conditional criteria and updates the event date for all previous events to the event date of the matched event.


moveToStartOfDay

Updates the event date to the start of the day for all events.


replacementMapping

Replaces the values of a property with values in the specified target mapping file. This function overrides the current value with the value in the lookup file where there is a matching key.

Note: If the lookup fails, the property value is set to none.


replacementMultipleMapping

Replaces the values of a property with values in multiple mapping files. This function overrides the current value with the value in the lookup file where there is a matching key.


resolveMixedTemporalAndTransTables

Removes duplicates and pushes the event date to the earliest date for the specified properties.

Note: When used, this rule must be the first business rule.


stripOthersValueFromTimestamp

Removes all additional information except event date from the timestamp.


Conversion functions

Convert values to specific data types so that you can perform additional operations. For example, convert a string to an integer so that you can perform additional mathematical calculations and produce new values.

toString

Converts a value to a string.


toBoolean

Converts a string to a Boolean value.


toDouble

Converts a value to a double.


toInt

Converts a value to an integer.


doubleToInt

Converts a double to an integer.


intToDouble

Converts an integer to a double.