Drop Fields From Input Array
Drop fields in an array using the array:drop()
function
Query
array:drop("a[]")
Introduction
The array:drop()
function is used to drop all
fields from an input array provided that the array has continuous,
sequential indexes with no empty indexes and that it starts at
[0].
In this example, the array:drop()
function is used to drop all fields of the array
a[].
Example incoming data might look like this:
a[0]=Dog |
---|
a[1]=Cat |
a[42]=Horse |
a[0]=Dog |
b[0]=Cat |
c[0]=Horse |
animal=cow |
Step-by-Step
Starting with the source repository events.
- flowchart LR; %%{init: {"flowchart": {"defaultRenderer": "elk"}} }%% repo{{Events}} 0[/Filter/] result{{Result Set}} repo --> 0 0 --> result style 0 fill:#ff0000,stroke-width:4px,stroke:#000;logscale
array:drop("a[]")
Takes the name of the array a[] and drops all fields of this array. Array b[] and array c[] will not be dropped in this example. Be aware that if there are empty entries in the array, only the fields from index 0 up to the first empty index will be dropped.
Event Result set.
Summary and Results
The query is used to drop all fields from a specific input array.
Sample output from the incoming example data:
b[0] | c[0] | animal |
---|---|---|
Cat | Horse | cow |