- Introduction to WorkXpress
- Building Your Application
- Examples and Best Practices
- Technical Manual
This shows you the differences between two versions of the page.
expression function - remove from list [2016/09/14 18:19] |
expression function - remove from list [2016/09/14 18:19] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Remove from List (Expression Function) ====== | ||
+ | ===== Purpose ===== | ||
+ | The **Remove from List** function (REMOVE_FROM_LIST) is used to remove a value from a list of separated values. | ||
+ | |||
+ | {{::remove_from_list_initial.png?direct&600|}} | ||
+ | ===== Parameters ===== | ||
+ | The **Remove from List** function has three parameters, two of which are required: | ||
+ | |||
+ | ==== List ==== | ||
+ | |||
+ | Allowed Inputs: [[Field|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 to Remove ==== | ||
+ | |||
+ | Allowed Inputs: [[Field|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|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 | ||
+ | |||
+ | ===== Output ===== | ||
+ | |||
+ | The output of the **Remove from List** function is a string comprised of the original list minus the text passed into the value to remove parameter. For example, if value1 holds the text 1,2,3,4,5,6 and value2 holds 5, REMOVE_FROM_LIST(value1,value2) would evaluate to 1,2,3,4,6. | ||
+ | |||
+ | ===== Example ===== | ||
+ | |||
+ | Most often used to remove a record from a multi-select field. E.g. if a [[Field Type - Selection|multi-select]] [[Field|field]] called "Employees" exists on a [[Record|record]] in the Company [[Table|table]] has the value "a4251|u124,a4251|u874,a4251|u563" in it, and an Employee record in the query has the WX System ID "a4251|u874", REMOVE_FROM_LIST(${Company ~> Employees (Stored Value)},${Employee ~> WX System ID},",") would result in "a4251|124,a4251|u563" (a valid input for a multi-selection field). |