Page 1 of 1

How to map contents of one column in one row to listitem.

Posted: Sun Dec 01, 2013 8:47 pm
by Jason Baird

I seem to find information on how to map and loop through the results of query to a listitem, but what I need to do is a bit different.

I use a query to get one record. In that one column I'm going to store several items.

Eg table:
_id code program
523... 0001 [a,b,c,d,e]

I need to put a,b,c,d,e into the listitems

So I need to know a few things...

A. Should the database column type be array or string?
B. Do I need to store the display name and the value? Eg. A:aa,B:bb...
C. Does it have to be stored in JSON format and if so is this correct for Appery? Eg: {[A:aa,B:bb...]}

On a sidenote this forum is really helpful and responsive. Thanks to all that participate.


How to map contents of one column in one row to listitem.

Posted: Sun Dec 01, 2013 10:42 pm
by Illya Stepanov

Hi Jason,

A. - Yes, type should be array.
B. - Depends, you can store ordered collection of values:
pre
[ "Monday", "Tuesday", ...
]
/pre
or you can store ordered key:values pairs:
pre
[ { "name" : "first item" }, { "name" : "second item" } ... ]
/pre
C. - Appery.io uses the standard JSON format (http://json.org/).


How to map contents of one column in one row to listitem.

Posted: Tue Dec 03, 2013 2:45 pm
by Jason Baird

Thanks IIIya!