Field Picker

Prev Next

The Field Picker is a configurable component that allows users to select a single option from a predefined list of fields. The list of items can be either hardcoded with items or populated with the url attribute.

Configuration Options

The picker can be configured through the following options in the config object:

Option

Type

Default

Description

Options

defaultItemId

string | null

null

ID of the default picked item (if not specified, defaults to first item)

fullItem

boolean

false

When true, returns the full item object instead of just the ID

showSelectNone

boolean

false

Determines if the option to select none is shown

search

string

""

Default search query string

Load Items with URL (for specific list)

Option

Type

Default

Description

Options

url

string | null

null

URL to fetch items from (optional)

Load Items with Default Model URLs

Option

Type

Default

Description

Options

dataModel

string | null

null

The SM model to use to populate the field list

"cycle", "downtime", "kpi", "part"

fieldType

array

["continuous", "categorical"]

The field types to include

"continuous", "categorical", "discrete", "datetime"

Data Model Picker + Asset Picker Example:

When both a data model picker and an asset picker are included in the picker list, the field picker will handle populating the items for you based on the selected model and asset.

{
  "type": "field",
  "search": '',
  "showSelectNone": true,
  "fullItem": true,
  "fieldTypes": ["categorical", "continuous"]
}

Asset Picker Example:

In situations where only a single data model is needed, you can add dataModel to the picker to specify the model the items should load from. Note: The above method will override this if a data model picker exists.

{
  "type": "field",
  "search": '',
  "showSelectNone": true,
  "fullItem": true,
  "dataModel": "downtime"
}

URL Example:

You can also specify a specific url to load the item from. Note the url response item should include name, display_name.

For even more flexibility, consider using the choice picker. Note: fieldType doesn't work with the url method.

{
  "type": "field",
  "search": '',
  "showSelectNone": true,
  "fullItem": true,
  "url": "/v1/selector/analytics/cycle/${getAssetType(asset)}/axis?stat_type=continuous,discrete&fixed_stat_type="
}

Default Query Params

The field picker generates the following params to the API Query:

Parameter

Type

Description

id

string

selected item id

title

string

selected item title

Other field information may be included:

Example request body with fullItem: true:

 "xaxes": {
  "pickerType": "field",
  "value": {
    "unit": "",
    "type": "categorical",
    "data_type": "string",
    "stream_types": [],
    "raw_data_field": "",
    "model": "cycle",
    "id": "shift",
    "title": "Shift"
  }
}

Example request body with fullItem: false:

"xaxes": {
  "pickerType": "field",
  "value": "shift"
}

Page Link

Example mapping for page link.

Assigning a specific system field.

{
  "mapping": {
        'field': '"shift"'
  }
}

Assigning a specific custom field.

{
  "mapping": {
        'field': '"stats__field_name__val"'
  }
}