Search

User Manual

GETTING STARTED


MODULES AND PLATFORM


APPENDIX


TUTORIALS & HELPFUL TRICKS


STRATEGIC PARTNER LINKS

Sepasoft - MES Modules
Cirrus Link - MQTT Modules

RESOURCES

Inductive University
Ignition Demo Project
Knowledge Base Articles
Forum
IA Support
SDK Documentation
SDK Examples

ALL USER MANUAL VERSIONS

Ignition 8.1
Ignition 7.9
Ignition 7.8

Deprecated Pages

Employees

Sign In

Skip to end of metadata
Go to start of metadata

This function is used by Ignition's Expression language.

Description

This looks for lookupValue in the lookupColumn of dataset. If it finds a match, it will return the value from the resultColumn on the same row as the match. If no match is found, noMatchValue is returned. Note: The type of the value returned will always be coerced to be the same type as the noMatchValue.

Syntax

lookup(dataset, lookupValue, noMatchValue[, lookupColumn][, resultColumn])

  • Parameters

DataSet dataset - A dataset to search through.

object lookupValue - The value to look for.

object noMatchValue - The result value if no match.

object lookupColumn - Optional. The column to lookup. Can either be the column index or the name of the column. Defaults to 0.

object resultColumn - Optional. The column to pull the result value from. Can either be the column index or the name of the column. Defaults to 1.

  • Results

object - The value in the result column of the same row that the lookupValue was found, or the noMatchValue if a match was not found. The data type of this object will always be coerced to match the type of the noMatchValue parameter. 

Examples

The examples are based of a table that has the following data in it:

ProductPriceCategory
"Apples"1.99"Fruit"
"Carrots3.5"Vegetable"
"Walnuts"6.25"Nut"
Code Snippet
lookup({Root Container.Table.data}, "Carrots", -1.0) //returns 3.50
Code Snippet
lookup({Root Container.Table.data}, "Grapefruit", -1) //returns -1, the noMatchValue
Code Snippet
lookup({Root Container.Table.data}, "Walnuts", "Unknown", 0, "Category") //returns "Nut"
Code Snippet
lookup({Root Container.Table.data}, "Pecans", "Unknown", 0, 2) //returns "Unknown", the noMatchValue
  • No labels