The datasource function is the part of the DocuMotor datasource functionality that goes into the JMES transformation.
Syntax
json_object datasource(string $dataSource, string $column, string $value)
This function fetches data from the specified $dataSource, filtering by $value lookup in $column. Function returns the entire JSON object where match is found.
Parameters
$datasource: The name of the data source to pull data from. Must be string value.
$column: The key to evaluate. Must be string value.
$value: The value to match. Must be string value.
Example
Rather than being data from an external system, below is from a DocuMotor data source.
[
{
"input" : "USD",
"iana" : "en-US"
},
{
"input" : "DKK",
"iana" : "da-DK"
}
]
The above data can be read as a table where keys are column headers and values are row data.
input | iana |
USD | en-US |
DKK | da-DK |
{
culture: datasource('DataSourceName', 'input', 'USD')
}
In above transformation, data source called “DataSourceName” is invoked. The column (or key) is defined to be “input” and the value to match is “USD”. This returns below JSON object from the data source.
{
"culture": {
"input": "USD",
"iana": "en-US"
}
}