# find-value-in-dictionary

## Description

<mark style="color:purple;">`find-value-in-dictionary`</mark> *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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cgps.gitbook.io/data-flo/reference-guide/find-value-in-dictionary.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
