A call offers very variable possibilities to integrate external providers and/or, in contrast to a transformation (fields are converted 1:1), to convert tables as desired. For example, it is possible to query a product ID from an external provider and insert the product data received into the table. Another example: A table row is to be split into several rows. Here, too, the data can be added, reorganized or removed as desired. Functions in JavaScript syntax are used for processing. This makes very complex calls possible.
- As usual, the operation can be dragged from the left column onto the workspace.
- Then the call is connected to the desired flow elements, in this case there is only one data source.
The function of the call is controlled via the Basic and Advanced Configuration tabs and started with the ‘Execute’ button:
Basic
- A meaningful name for the call should be assigned
- In the ‘call script’ an action is defined for or with the data, in this example the data is simply passed on to the ‘Advanced config’.
Advanced Config
Here is defined what is to happen with the received data. In the example, two are generated from each line and ‘aaa’ is appended to the contents of the second.
Another example:
In the data source only an ID and a ‘language Tag’ are available. With a query at icecat product data should be added. ‘Basic’ Tab:
function callOperation(row) {
return getJson("https://live.icecat.biz/api/?shopname=openIcecat-live&Language="+row.lang+"&icecat_id="+row.icecat_id);
}
A Get-Request is executed which contains the ID and the ‘language Tag’. The response comes in the format ‘json’ and contains the data found for the ID. In this example, the response contains a lot of data, but only the features, name and value are to be used.
‘Advanced config’ Tab:
function getAttributesFromCall(resultFromCall) {
//return the rows that should be piped to the next operation
result = {ProductName: resultFromCall.data.GeneralInfo.ProductName, IcecatId: resultFromCall.data.GeneralInfo.IcecatId};
resultFromCall['data']['FeaturesGroups']
.forEach(featureGroup => {
featureGroup['Features'].forEach(feature => {
result[feature['Feature']['Name']['Value']] =
feature['PresentationValue'];
})
})
return result;
}
The result is a table with numerous product data that can now be processed in further operations.