Hi All,
i read a lot of topic by i didn't' found the solution for my case.
My target is read a data table through a data action in order to receive ad array of results in base of the filter applied.
The details:
Data Table:
structure
key,Indirizzo,Orario,Telefono,Comune,Provincia
i create a data action with this configuration
input contract:
{
"title": "Comune",
"type": "object",
"properties": {
"Comune": {
"type": "string"
}
},
"additionalProperties": true
}
Output contract
{
"title": "Sportelli",
"type": "object",
"properties": {
"Sportello": {
"type": "object",
"properties": {
"Indirizzo": {
"type": "string"
},
"Orario": {
"type": "string"
},
"Telefono": {
"type": "integer"
},
"Comune": {
"type": "string"
},
"Provincia": {
"type": "string"
}
},
"additionalProperties": true
}
},
"additionalProperties": true
}
Request URL Template
/api/v2/flows/datatables/#########################/rows?showbrief=false&Comune=${input.Comune}
Configuration : Request:
{
"requestUrlTemplate": "/api/v2/flows/datatables/#################/rows?showbrief=false&Comune=${input.Comune}",
"requestType": "GET",
"headers": {},
"requestTemplate": "${input.rawRequest}"
}
Configuration : Response:
{
"translationMap": {
"Sportello": "$.entities[?(@.Comune == 'Firenze')]"
},
"translationMapDefaults": {},
"successTemplate": "{ \"Sportello\": ${successTemplateUtils.firstFromArray(${Sportello},\"\")} }"
}
If i test i receive this output ( all data are fake)
{
"Sportello.Telefono": 55062#####,
"Sportello.key": "01",
"Sportello.Indirizzo": "Via Dante Alighieri uno",
"Sportello.Provincia": "Firenze",
"Sportello.Comune": "Firenze",
"Sportello.Orario": "Lunedì Venerdì dalle nove alle tredici e dalle quattordici alle diciotto"
}
this return only the first record of data table. the correct result should be 2 records. these will be used into inbound flow.
Moreover the parameter Comune=${input.Comune} added into URL doesn't work fine in fact into json i put Firenze directly into code "Sportello": "$.entities[?(@.Comune == 'Firenze')]"
Someone can help me?
Thanks in advance