The arrayfilter( function processes each element of a text array or a data array with a formula (see Text Arrays and Data Arrays).


This function has three parameters:

text – The array that you want to process.

separator – Is the separator character or characters for this array. This parameter is omitted if the target array is a data array.

formula – is the formula for filtering. The function operates by scanning the array element by element. For each element it processes the data with the formula you supply. The formula can use the import() function to access the actual value of the array element being processed. The seq( function can be used to access the array element number. The newly calculated values are used to create a new version of the original array. Note: The entire formula must be quoted using quote characters that are not used within the formula itself. A good way to do this in most situations is to use curly braces or multiple pipe characters to quote the entire formula.


This function filters the contents of an array. Rather than using a fixed processing method to filter the array, it allows the programmer to supply a formula that is used over and over again to filter each individual element of the array.

Here is a simple formula that adds parentheses around each element of an array. The formula uses the import( function to include the original array value in the newly processed array.

arrayfilter("Gold,Copper,Aluminum",",",{"("+import()+")"}) ☞ (Gold),(Copper),(Aluminum)

This formula adds sequential numbers to the elements of an array. To do that it uses the seq( function, which returns the number of each array element.

arrayfilter("Jack,Sue,Mark,Brian",",",{seq()+". "+import()}) ☞ 1. Jack,2. Sue,3.,Mark,4.Brian

You can use any formula operator or function you want to process the array elements.

arrayfilter("Jack Wilson,Sue Billings,Mark Smith,Brian Cummings",",",|||"("+seq()+") "+
    firstword(import())+" "+upper(lastword(import())|||)
    ☞ (1) Jack WILSON,(2) Sue BILLINGS,(3) Mark SMITH,(4) Brian CUMMINGS
arrayfilter("Jack Wilson;Sue Billings;Mark Smith;Brian Cummings",";",|||lastword(import())+", "+
    ☞ Wilson, J;Billings, S;Smith, M;Cummings, B

Working with Data Arrays

This function works with both data arrays and text arrays. Because Data Arrays have no separators between elements, the separator parameter is omitted when targeting a data array.

In this example, the arrayfilter( function is used to access a data array containing five integers and multiply each of the numbers by 10.

arrayfilter(dataarray(3, 12, 9, 7, 25),{import()*10})

The result will be a new data array containing 30, 120, 90, 70 and 250.

Error Messages

Assorted error messages – If the formula supplied by the user contains an error, the operation is aborted and the error is returned.

See Also


10.0UpdatedCarried over from Panorama 6.0, but now is a native function instead of being implemented with a procedure. More than one character is now allowed for use as the separator parameter.