Xml Array mapping not working when array has only one item.
Is there a way to raise this as a bug. The mapping should look at the mapping array checkbox not the incoming XML to determine if it should be mapped to an array.
Thanks Rick/
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
Is there a way to raise this as a bug. The mapping should look at the mapping array checkbox not the incoming XML to determine if it should be mapped to an array.
Thanks Rick/
Hi Rick,
This is not a bug. In Response you can specify any structure, and change it as you need (add new fields, tick 'Array'). Customizing service response to the specified structure is a thankless task. So the data is parsed as they come.
How can it not be a bug that if I explicitly specify that the response xml contains an array that the mapping ignores the mapping and fails to display the single item in the list. Why have an array check box if it is going to be ignored?
The suggested work around is to not use the XML mapping feature at all and instead to write my own generic service that has to parse and map the xml myself.
Please raise as a bug.
Rick,
The data for mapping is obtained from the actual response. There is no array in the actual server response.
This is the disadvantage of XML. If you have received json in response - there wouldn't be this issue.
[quote:]write my own generic service that has to parse and map the xml myself[/quote] No, you only need to receive and parse the response. You can map it in the visual editor as before.
There is also another option. On the service success event, check if the Alarm is not an array - then mapping was not done, which means you should add the data from the Alarm to page using JavaScript. If it is easier for you - you can do so.