Breadcrumbs

concatArrays() Operation

Concatenates the elements of one or more arrays to a target array.

Syntax

anArray.concatArrays(anotherArray_1, ..., anotherArray_n)

Semantics

Concatenates the elements of one or more arrays to the elements of anArray. All arrays must have the same array element type.

  • The arrays to be concatenated cannot be NULL.

  • If an array has NULL elements, these will be preserved after concatenation.

Substitutables

anArray, anotherArray

Can be any variable or object attribute having the type Array. The arrays must not be NULL.

Error Codes

Find the related error codes on System Errors.

BESM/2

One of the parameters of a vararg function returned NULL.
This error occurs if one of the arrays is NULL.

Examples

Input: an array of customers and an array of prospects

JSON
{ "customers": [
    {"company": "Summer Ltd.", "name": "Adam Sun"},
    {"company": "Summer Ltd.", "name": "Barbara Beaches"},
    {"company": "Winter & Partners", "name": "John Snow"}
]}
JSON
{ "prospects": [
    {"company": "Spring Corp.", "name": "Rose Bloom"},
    {"company": null, "name": null},
    {"company": "Summer Ltd.", "name": "Cloe Cloud"}
]}
set resultArray = customers.concatArrays(prospects);

A new array resultArray is created containing all references to elements of the listed arrays.

JSON
{ "resultArray": [
    {"company": "Summer Ltd.", "name": "Adam Sun"},
    {"company": "Summer Ltd.", "name": "Barbara Beaches"},
    {"company": "Winter & Partners", "name": "John Snow"},
    {"company": "Spring Corp.", "name": "Rose Bloom"},
    {"company": null, "name": null},
    {"company": "Summer Ltd.", "name": "Cloe Cloud"}    
]}

The NULL values of the prospect array are preserved.

Note that the resultArray contains object references to the array elements of customers and prospects. Refer to https://scheer-pas-doc.atlassian.net/wiki/pages/createpage.action?spaceKey=designer&title=%2825.3%29%20Object%20References&linkCreation=true&fromPageId=623151310 to get a better understanding of the effects.

ActionScript_ArrayOperations_Example

Click here to download a simple example model that shows how to use Action Script to handle arrays with Scheer PAS Designer.

📗