Working with Lists

The following are common functions used to manage a list of values.


[Pages 109 - 110]

Function

Description

Example

@Elements

Counts the number of items in a list and returns a number. Syntax:

@Elements ( list );  

listA list of elements.

@Elements ("April":"May":"June");  

Result: 3

@Explode

Converts a text string into a list of elements. You can optionally specify a string delimiter. If a string delimiter is not specified, the function will default to a space, semicolon, or comma. Syntax:

@Explode ( string ); @Explode ( string; delimiter);  

stringA string of text values.

delimiterAn optional text string separator.

Data:="April May June"; @Explode (Data;" ");  

Result: "April": "May": "June"

@Implode

Converts a list of elements into a single text string. Optionally, you can specify a string delimiter. Syntax:

@Implode (list); @Implode (list; delimiter);  

lista list of elements.

delimiteran optional text string separator.

Data:= "April": "May": "June"; @Implode (Data;" ");  

Result: "April May June"

@IsMember

Searches for a value within a text string. Returns a numeric 1 if found and 0 if not found. Syntax:

@IsMember (string; list);  

stringThe search string.

listA list of elements.

Data:= "April": "May": "June"; @IsMember ("April"; Data);  

Result: 1

@Replace

Searches a list for an element. If the element is found, it is replaced with the new element.

@Replace (searchlist; oldlist; newlist);  

searchlistThe list of elements to be searched.

oldlistThe list of value(s) to be replaced.

newlistThe new list of replacement value(s)

Data:= "April": "Dec": "June"; @Replace (Data; "Dec"; "May"); Result: "April": "May": "June"  

@Select

Returns the value specified in the n-th number position. If the number specified is greater than the total values, then the last value is returned. Syntax:

@Select (number; value1; value2; valueN);  

numberItem number to select.

value1First value.

value2Second value.

valueNLast value.

@Select(3; "April"; "May"; "June")  

Result: "June"

@Word

Selects the word specified in the n-th number position. Words are determined based on the string delimiter. Syntax:

@Word (string; delimiter; number);  

stringThe string to be searched.

delimiterThe value used to separate "words."

numberThe word to select from the search string.

Data:="April~May~June"; @Word (Data; "~"; 3);  

Result: "June"

Категории