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.
If lookupColumn is not specified, it defaults to 0. If resultColumn is not specified, it defaults to 1.
lookup(dataset, lookupValue, noMatchValue[, lookupColumn][, resultColumn])
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.
object resultColumn - Optional. The column to pull the result value from. Can either be the column index or the name of the column.
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 examples are based of a table that has the following data in it: