JsonArray - script and chart function
JsonArray aggregates and concatenates JSON data.
Syntax:
json JsonArray([DISTINCT][TOTAL] value [, sort_weight])
Return data type: dual
Argument | Description |
---|---|
DISTINCT |
If the word DISTINCT occurs before the function arguments, duplicates resulting from the evaluation of the function arguments are disregarded. |
TOTAL |
If the word TOTAL occurs before the function arguments, the calculation is made over all possible values given the current selections, and not just those that pertain to the current dimensional value, that is, it disregards the chart dimensions. |
value | Input field. The expression containing the data to be sorted. The first (lowest) value of sort_weight is found, from which the corresponding value of the value expression is determined. If you place a minus sign in front of sort_weight, the function returns the last (highest) sorted value instead. |
sort_weight | Input field. The expression containing the data to be sorted. The first (lowest) value of sort_weight is found, from which the corresponding value of the value expression is determined. If you place a minus sign in front of sort_weight, the function returns the last (highest) sorted value instead. |
Example:
The following load script loads and aggregates data with JsonArray.
This results in the following table of data:
Id | Json | JsonDistinct | JsonSorted |
---|---|---|---|
1 | [123] | [123] | [123] |
2 | ["json text","normal text"] | ["json text","normal text"] | ["normal text","json text"] |
3 | [[1,2,3],[1,2,3],{"name":"abc"}] | [[1,2,3],{"name":"abc"}] | [[1,2,3],{"name":"abc"},[1,2,3]] |
4 | [1,"2 and text",""] | [1,"2 and text",""] | [1,"2 and text",""] |