Lookup

Gets data from a lookup file in configuration

lookup.get(file: string, key: string, column: number, defaultValue?: string)
Arguments:
  • file – Filename that content data

  • key – Value of the first column of the line searched

  • column – Number of the column

  • defaultValue – Default value that is returned in case column has no values.

Returns:

Returns a string corresponding to the key and :guilabel`column`.

lookup.getLine(file: string, key: string, defaultValue?: string[])
Arguments:
  • file – Filename that content data

  • key – Value of the first column of the line searched

  • defaultValue – List of default values that are returned in case line has no values.

Returns:

Returns a list of string corresponding to the key and :guilabel`column`.

lookup.has(file: string, key: string, column: number)

Example to check if a value exists and get it.

if (lookup.has("file.lookup", "35665", 0)) {
    let infos = lookup.get("file", "35665", 0);
    console.log(infos);
    return true;
}
return false;
Arguments:
  • file – Filename that content data

  • key – Value of the first column of the line searched

  • column – Number of the column to check if element exist.

Returns:

Returns a boolean indicating if the element exists.

lookup.hasLine(file: string, key: string)
Arguments:
  • file – Filename that content data

  • key – Value of the first column of the line searched

Returns:

Returns a boolean indicating if the line corresponding to the key exists.