find-value-in-dictionary

Description

find-value-in-dictionary adaptor finds a key in a dictionary and returns its associated value.

If no value is found, it will return a specified default value. If no default value is set, no value will be returned.

Inputs

dictionary Type: dictionary Required: Yes The dictionary to lookup the key-value pair.

key Type: text Required: Yes The key to be found.

case sensitive Type: boolean Required: No When set to False, lowercase and uppercase letters are treated as equivalent when matching values, e.g. Peru = peru. If unspecified, defaults to False.

match diacritics Type: boolean Required: No When set to False, letters with and without diacritics are treated as equivalent when matching values, e.g. Perú = Peru. If unspecified, defaults to False.

default value Type: text Required: No A value to be returned if key is not found in dictionary. If unspecified, no value will be returned.

Outputs

value Type: text The value in dictionary associated to key if found, otherwise default value will be returned.

Examples

Example 1: Default behaviour.

Inputs:

dictionary:

KEY
VALUE

GB

United Kingdom

TR

Turkey

US

United States

IND

India

key: US

case sensitive: null (empty)

match diacritics: null (empty)

default value: null (empty)

Outputs:

value: United States

-> Found the value United States for the key US in the datatable.

Example 2: If no key is found, return a default value.

Inputs:

dictionary:

KEY
VALUE

GB

United Kingdom

TR

Turkey

US

United States

IND

India

key: JP

case sensitive: null (empty)

match diacritics: null (empty)

default value: Value not found

Outputs:

value: Value not found

-> Since the key JP doesn't exist in the dicitionary, the default value Value not found is returned.

Example 3: Find value when case sensitive is set to true.

Inputs:

dictionary:

KEY
VALUE

GB

United Kingdom

TR

Turkey

US

United States

IND

India

key: us

case sensitive: True

match diacritics: True

default value: United States of America

Outputs:

value: Value not found

-> Since case sensitive is set to True the key us didn't match with the key US in the dictionary, the default value Value not found is returned.

Last updated