FieldIndex - script and chart function
FieldIndex() returns the position of the field value value in the field field_name (by load order).
Syntax:
FieldIndex(field_name , value)
Return data type: integer
Arguments:
Argument | Description |
---|---|
field_name | Name of the field for which the index is required. Must be given as a string value. This means that the field name must be enclosed by single quotes. |
value | The value of the field field_name. |
Limitations:
If value cannot be found among the field values of the field field_name, 0 is returned.
Examples and results:
The following example uses two fields: First name and Initials.
First name | Initials |
---|---|
John | JA |
Sue | SB |
Mark | MC |
Peter | PD |
Jane | JE |
Peter | PF |
Examples | Results |
---|---|
FieldIndex ('First name','John') |
1, because 'John' appears first in the load order of the First name field. Note that in a filter pane John would appear as number 2 from the top as it's sorted alphabetically and not as in the load order. |
FieldIndex ('First name','Peter') |
4, because FieldIndex() returns only one value, that is the first occurrence in the load order. |
Data used in example:
Initials:
LOAD * inline [
"First name"|Initials|"Has cellphone"
John|JA|Yes
Sue|SB|Yes
Mark|MC |No
Peter|PD|No
Jane|JE|Yes
Peter|PF|Yes ] (delimiter is '|');
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!