Add to List (Expression Function)

Purpose

The Add to List function (ADD_TO_LIST) is used to add a value to a list of separated values.

Parameters

The Add to List function has four parameters, two of which are required:

List

Allowed Inputs: field value or text string

The first required parameter of the Add to List function is the string with which contains the existing list. Either use the use the Query Builder to choose a field that contains the list or use type a value to start with a text string that defines a static list of values.

Value

Allowed Inputs: field value or text string

The second required parameter is the string to be added to the list. It can either be obtained from a field using the Query Builder or from a literal string.

Separator

Allowed Inputs: field value or text string

The third parameter, which is optional, is a string used to denote what type of separator the list uses. If no value is entered for the third parameter, the function uses a comma as the separator. The value can either be obtained from a field using the Query Builder or it can be a literal string

Remove Duplicates

Allowed Inputs: omitted or “yes”

The fourth parameter, which is optional, is a string used to determine if duplicate values will be removed from the list. If this parameter is omitted then duplicates will not be removed from the resulting list. If the parameter is set to “yes” then any duplicates found in the list will be removed including any duplicates that were already in the initial list. If this parameter is used then the separator must also be defined in the third parameter

Output

The output of the Add to List function is a string comprised of the original list with the text passed into the value parameter concatenated onto the end and separated by the specified separator. For example, if value1 holds the text 1,2,3,4,6 and value2 holds 5, ADD_TO_LIST(value1,value2) would evaluate to 1,2,3,4,6,5.

Example

Most often used to add a record to a multi-select field that may or may not already have values in it. E.g. if a multi-select field called Employees on a Company record has the value “a4251|u124,a4251|u563” in it, and an Employee record in the query has the WX System ID “a4251|u874”, ADD_TO_LIST(${Company ~> Employees (Stored Value)},${Employee ~> WX System ID},“,”) would result in “a4251|124,a4251|u563,a4251|u874” (a valid input for a multi-selection field).

expression function - add to list.txt · Last modified: 2016/09/14 18:19 (external edit)
Copyright WorkXpress, 2024