How using an array from Data Action, to populate a datatable

Hi all,
we're trying to develop this flow:

  • from Architect, we call a data action that ask to a webservice to receive a set of data in array format;

Input Contract:{

Input Contract:{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "gsysGetOpenCases",
"description": "Questo entryPoint restituisce l’elenco dei Casi aperti di interesse per Genesys",
"type": "object",
"properties": {}
}

Output Contract:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "gsysGetOpenCases",
"description": "Questo entryPoint restituisce l’elenco dei Casi aperti di interesse per Genesys",
"type": "object",
"properties": {
"id": {
"description": "id",
"type": "array",
"default": ""
},
"nome": {
"description": "nome",
"type": "array",
"default": ""
},
"posizione": {
"description": "posizione",
"type": "array",
"default": ""
},
"date_entered": {
"type": "array",
"default": ""
},
"datarichiamo": {
"type": "array",
"default": ""
},
"targa": {
"type": "array",
"default": ""
},
"nomecli": {
"type": "array",
"default": ""
},
"cognomecli": {
"type": "array",
"default": ""
},
"companyid": {
"type": "array",
"default": ""
},
"company": {
"type": "array",
"default": ""
},
"agencyid": {
"type": "array",
"default": ""
},
"agency": {
"type": "array",
"default": ""
},
"ffirstcall": {
"type": "array",
"default": ""
},
"ismono": {
"type": "array",
"default": ""
},
"provinciares": {
"type": "array",
"default": ""
},
"tpolizza": {
"type": "array",
"default": ""
},
"broker": {
"type": "array",
"default": ""
},
"hasticket": {
"type": "array",
"default": ""
},
"telefono1": {
"type": "array",
"default": ""
},
"telefono2": {
"type": "array",
"default": ""
},
"posizione_desc": {
"type": "array",
"default": ""
},
"tpolizza_desc": {
"description": "posizione_desc",
"type": "array",
"default": ""
},
"area": {
"type": "array",
"default": ""
}
}
}

Request JSON:

{

"requestUrlTemplate": "https://genesystest.carclinic.it/carclinictest/index.php?entryPoint=gsysGetOpenCases&limit=99",

"requestType": "GET",

"headers": {},

"requestTemplate": "${input.rawRequest}"

}

RESPONSE:

{
"translationMap": {
"area": ".list[*].area", "nomecli": ".list[].nomecli",
"agency": ".list[*].agency", "nome": ".list[
].nome",
"agencyid": ".list[*].agencyid", "broker": ".list[].broker",
"targa": ".list[*].targa", "datarichiamo": ".list[
].datarichiamo",
"companyid": ".list[*].companyid", "provinciares": ".list[].provinciares",
"hasticket": ".list[*].hasticket", "posizione": ".list[
].posizione",
"date_entered": ".list[*].date_entered", "ismono": ".list[].ismono",
"telefono1": ".list[*].telefono1", "posizione_desc": ".list[
].posizione_desc",
"company": ".list[*].company", "telefono2": ".list[].telefono2",
"tpolizza_desc": ".list[*].tpolizza_desc", "id": ".list[
].id",
"cognomecli": ".list[*].cognomecli", "tpolizza": ".list[*].tpolizza",
"ffirstcall": ".list[*].ffirstcall" }, "translationMapDefaults": {}, "successTemplate": "{\n\"id\":{id},\n"nome":{nome},\n\"posizione\":{posizione},\n"date_entered":{date_entered},\n\"datarichiamo\":{datarichiamo},\n"targa":{targa},\n\"nomecli\":{nomecli},\n"cognomecli":{cognomecli},\n\"companyid\":{companyid},\n"company":{company},\n\"agencyid\":{agencyid},\n"agency":{agency},\n\"ffirstcall\":{ffirstcall},\n"ismono":{ismono},\n\"provinciares\":{provinciares},\n"tpolizza":{tpolizza},\n\"broker\":{broker},\n"hasticket":{hasticket},\n\"telefono1\":{telefono1},\n"telefono2":{telefono2},\n\"posizione_desc\":{posizione_desc},\n"tpolizza_desc":{tpolizza_desc},\n\"area\":{area}}"
}

from Architect, we take the first or the second position of array, and we use a data action to put data in DataTable: all works correctly.

But if from Architect we try to take from third position of array (in case of image below, is the fifth), nothing is write in datatable using the same action.

What could be the cause of this? maybe the build of array is not correct or there is a sort of limitation in this case?

Hi sandrokan77,

To make it easier for people to look at your question could you attach an export of your data action and include an example .json file of the response from the web service? It is fine to cover any sensitive information in the data action or response, as long as you don't change the structure of either one.

--Jason

gsysGetOpenCasesnomev04-20190719145436.custom.json (5.0 KB)
export_Output_Action.json (53.3 KB)

Hi all,
perhaps someone could have an idea? :slight_smile:
BR

Hello

Try to change the translationMap removing the "list[*]" part:

"translationMap": {
    "area": "$.area",
    "nomecli": "$.nomecli",
    "agency": "$.agency",
    "nome": "$.nome",
    "agencyid": "$.agencyid",
    "broker": "$.broker",
    "targa": "$.targa",
    "datarichiamo": "$.datarichiamo",
    "companyid": "$.companyid",
    "provinciares": "$.provinciares",
    "hasticket": "$.hasticket",
    "posizione": "$.posizione",
    "date_entered": "$.date_entered",
    "ismono": "$.ismono",
    "telefono1": "$.telefono1",
    "posizione_desc": "$.posizione_desc",
    "company": "$.company",
    "telefono2": "$.telefono2",
    "tpolizza_desc": "$.tpolizza_desc",
    "id": "$.id",
    "cognomecli": "$.cognomecli",
    "tpolizza": "$.tpolizza",
    "ffirstcall": "$.ffirstcall"
  }

Also, change the output contract to:

{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "gsysGetOpenCases",
"description": "Questo entryPoint restituisce l’elenco dei Casi aperti di interesse per Genesys",
"type": "object",
"properties": {
  "id": {
	"description": "id",
	"type": "array",
	"items": {
		"type": ["string","null"],
		"default": ""
	}
  },
  "nome": {
	"description": "nome",
	"type": "array",
	"items": {
		"type": ["string","null"],
		"default": ""
	}
  },
  "posizione": {
	"description": "posizione",
	"type": "array",
	"items": {
		"type": ["string","null"],
		"default": ""
	}
  },
  "date_entered": {
	"type": "array",
	"items": {
		"type": ["string","null"],
		"default": ""
	}
  },
  "datarichiamo": {
	"type": "array",
	"items": {
		"type": ["string","null"],
		"default": ""
	}
  },
  "targa": {
	"type": "array",
	"items": {
		"type": ["string","null"],
		"default": ""
	}
  },
  "nomecli": {
	"type": "array",
	"items": {
		"type": ["string","null"],
		"default": ""
	}
  },
  "cognomecli": {
	"type": "array",
	"items": {
		"type": ["string","null"],
		"default": ""
	}
  },
  "companyid": {
	"type": "array",
	"items": {
		"type": ["string","null"],
		"default": ""
	}
  },
  "company": {
	"type": "array",
	"items": {
		"type": ["string","null"],
		"default": ""
	}
  },
  "agencyid": {
	"type": "array",
	"items": {
		"type": ["string","null"],
		"default": ""
	}
  },
  "agency": {
	"type": "array",
	"items": {
		"type": ["string","null"],
		"default": ""
	}
  },
  "ffirstcall": {
	"type": "array",
	"items": {
		"type": ["string","null"],
		"default": ""
	}
  },
  "ismono": {
	"type": "array",
	"items": {
		"type": ["string","null"],
		"default": ""
	}
  },
  "provinciares": {
	"type": "array",
	"items": {
		"type": ["string","null"],
		"default": ""
	}
  },
  "tpolizza": {
	"type": "array",
	"items": {
		"type": ["string","null"],
		"default": ""
	}
  },
  "broker": {
	"type": "array",
	"items": {
		"type": ["string","null"],
		"default": ""
	}
  },
  "hasticket": {
	"type": "array",
	"items": {
		"type": ["string","null"],
		"default": ""
	}
  },
  "telefono1": {
	"type": "array",
	"items": {
		"type": ["string","null"],
		"default": ""
	}
  },
  "telefono2": {
	"type": "array",
	"items": {
		"type": ["string","null"],
		"default": ""
	}
  },
  "posizione_desc": {
	"type": "array",
	"items": {
		"type": ["string","null"],
		"default": ""
	}
  },
  "tpolizza_desc": {
	"description": "posizione_desc",
	"type": "array",
	"items": {
		"type": ["string","null"],
		"default": ""
	}
  },
  "area": {
	"type": "array",
	"items": {
		"type": ["string","null"],
		"default": ""
	}
  }
}
}

Regards

Hi Adrian,
seems to doesn't work:

Resolve translation map: Failed while processing the translation map. Could not resolve value for the key: 'nomecli' and no default value was configured. Additional details: No results for path: $['nomecli']

BR

Hello

Try, instead of removing "list[*]", replacing it by a 0:

"translationMap": {
    "area": "$.0.area",
    "nomecli": "$.0.nomecli",
    "agency": "$.0.agency",
    "nome": "$.0.nome",
    "agencyid": "$.0.agencyid",
    "broker": "$.0.broker",
    "targa": "$.0.targa",
    "datarichiamo": "$.0.datarichiamo",
    "companyid": "$.0.companyid",
    "provinciares": "$.0.provinciares",
    "hasticket": "$.0.hasticket",
    "posizione": "$.0.posizione",
    "date_entered": "$.0.date_entered",
    "ismono": "$.0.ismono",
    "telefono1": "$.0.telefono1",
    "posizione_desc": "$.0.posizione_desc",
    "company": "$.0.company",
    "telefono2": "$.0.telefono2",
    "tpolizza_desc": "$.0.tpolizza_desc",
    "id": "$.0.id",
    "cognomecli": "$.0.cognomecli",
    "tpolizza": "$.0.tpolizza",
    "ffirstcall": "$.0.ffirstcall"
  }

I tried to replicate your problem, but I had to make some changes, so I may have made some mistake when adapting it to your solution.

One question: Did you use any JSON parser tool to help you to write the translation map? If not, you can try to use this one. It helps me a lot when I have to parse very complex jsons.

Also, after testing the Data Action, the "Execute" step shows the raw response of the Web Service. Please, check if that response is exactly the same as the export_Output_Action.json that you uploaded, because the response I have written the translation map for might not be the same as yours.

Regards

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.