ARR. - Array Commands

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Arrays and Data-Structures > Array -Commands > !String-Arrays >

ARR. - Array Commands

ARR.ArrayToVar

Previous Top Next


SPR Script Language

 

ARR.ArrayToVar

Converts a global array of strings into a single, CR-LF delimited variable.

 

Intention

 

After populating a global array with data, you often need to view or process that list as a whole. The ARR.ArrayToVar command is a utility that takes all the elements from a specified array (starting from index 1) and joins them together into a single string variable, with each element separated by a newline (`$crlf$`).

 

This is perfect for displaying results in a message box, writing them to a log file, or passing the entire list as a single parameter to another command. This version is specifically for arrays containing string data.

 

Illustration

📎 Paperclip: This command takes a stack of individual pages (the array elements) and clips them together into a single, easy-to-handle report (the string variable).

 

Syntax

 

ARR.ArrayToVar|P1|P2

 

Parameter Explanation

 

P1 - Array-No. - (Numeric, Required)

The number (0-32) of the source global array.

 

P2 - $$Des - (Variable, Required)

The variable where the final, CR-LF delimited result string will be stored.

 

Examples

 

'***********************************

' ARR.ArrayToVar - Sample 1: Displaying Array Contents

'***********************************

' First, create and populate an array

ARR.Set|1|1|First line

ARR.Set|1|2|Second line

ARR.Set|1|3|Third line

' Now, convert that array into a single string variable

ARR.ArrayToVar|1|$$res

' Display the results in a message box

MBX.Array contents:$crlf$$$res

ENR.

'

 

Remarks

 

- This command has an alias: ARR.ATV.

- This command specifically skips element 0 of the source array, which is often used for summary data.

- For arrays containing numeric data, use ARR.ArrayToVarInt or ARR.ArrayToVarFp for correct conversion.

 

See also:

 

ARR.ArrayToVarInt

ARR.ArrayToVarFp

FIL.ArrayToVar