Page 1 of 1

REST service response with only one element in the array

Posted: Fri Apr 26, 2013 5:31 pm
by Rafael Martínez

We are building a select element based on a response of a REST Service. This works fine when the array has more than one element, but if the array has only one element doesn't work, the select element don't show the value.


REST service response with only one element in the array

Posted: Fri Apr 26, 2013 6:07 pm
by Kateryna Grynko

Hi Rafael,

We cannot reproduce this. Could you please provide us with sample data?


REST service response with only one element in the array

Posted: Fri Apr 26, 2013 6:17 pm
by Rafael Martínez

You are wright, the problem is not the length of the array, the issue is when in the URL there are parameters with spaces, but the test of the REST service works fine, example:
Image
Image
Image


REST service response with only one element in the array

Posted: Fri Apr 26, 2013 6:38 pm
by Rafael Martínez

We can "solve" this issue if we use values without blank spaces in the select, but this is a lot work for us because it impact in the database schema.

We need to know if this is or not an issue of Appery for you.

Thanks in advance.


REST service response with only one element in the array

Posted: Fri Apr 26, 2013 6:57 pm
by Kateryna Grynko

We'll test this...


REST service response with only one element in the array

Posted: Fri Apr 26, 2013 7:48 pm
by Kateryna Grynko

The Mapping works for us with the provided JSON data. Please send me a screen shot of your mapping. Probably you've mapped response parameter "CAT1" to Label property, then the void item without text won't be displayed in Select Menu.


REST service response with only one element in the array

Posted: Fri Apr 26, 2013 8:55 pm
by Rafael Martínez

We are mapping both properties of the select (Value and Label) to the same parameter CAT3. CAT1 is never used for us.

Could be the problem blank spaces in the value of the select?

Image Image


REST service response with only one element in the array

Posted: Mon Apr 29, 2013 10:09 am
by Kateryna Grynko

Hi Rafael,

To delete spaces from Select component value you should in mapping in front of Request parameters CAT1 and CAT3L click "Add JS" and enter:
codereturn value.trim();/code
So in Select component value there will be no spaces in the beginning and in the ending.


REST service response with only one element in the array

Posted: Mon Apr 29, 2013 1:36 pm
by Rafael Martínez

We have changed our database schema using keys without blank spaces and all work fine.

Appery is great. Thank you.