StrJoin

StrJoin

%StrJoin function


Function

This function returns string of text values from column of local variable Record joined by separator.

Declaration

TEXT %StrJoin( in refToColumn ,TEXT in separator [,INT in mode := 0 [,INT in idxFrom := 1 [,INT in idxTo := Last]]] )

Parameter

refToColumn

Reference to a column of local variable of the Record type.

separator

A string separating values from the column in the final string.

mode

Parameter that decides what function does when it encounters invalid or non-text value. (This parameter is set to 0 by default)

0 - Function returns invalid string

1 - Treats invalid/non-text values as empty strings and continues processing

2 - Skips invalid/non-text values and continues processing

idxFrom

Index of starting row. (This parameter is set to 1 by default)

idxTo

Index of final row. (This parameter is set to last index of given local variable of the Record type by default)

Description

The function processes a specified column of local variable Record, joining the values from a range of rows into a single string.

Example

BEGIN RECORD NOALIAS (SD.TEXT_ARR) _arr TEXT _txt REDIM _arr[3] _arr[1]^Text := "London" _arr[2]^Text := "New York" _arr[3]^Text := "Tokyo" _txt := %StrJoin(_arr^Text, ", ") ; _txt => "London, New York, Tokyo" REDIM _arr[6] _arr[5]^Text := "Paris" _arr[6]^Text := "Madrid" ; _arr[4]^Text => Invalid String _txt := %StrJoin(_arr^Text, ", ") ; _txt => Invalid String _txt := %StrJoin(_arr^Text, ", ", 0, 5, 6) ; _txt => "Paris, Madrid" _txt := %StrJoin(_arr^Text, ", ", 1) ; _txt => "London, New York, Tokyo, , Paris, Madrid" _txt := %StrJoin(_arr^Text, ", ", 2) ; _txt => "London, New York, Tokyo, Paris, Madrid" END