Get all values of custom list

190 views
Skip to first unread message

mgonzalez...@gmail.com

unread,
Nov 13, 2014, 6:50:55 PM11/13/14
to suppor...@runmyprocess.com
Hi

I'm trying to get all content values of a custom list into a variable in a array, but i use the method getlist(), and i recive the values the picture 1

var a = id_diasinabiles.getList();
alert(a);

I need is to get only the valuesof the list and pass it to a variable rate under such
var a = ['2014,00,01' '2014,01,03' ....];

Could anyone help me here please?

Regards
Marcos

thoshino

unread,
Nov 13, 2014, 7:20:37 PM11/13/14
to suppor...@runmyprocess.com, mgonzalez...@gmail.com
Hi,

Can you try something like this?

a = JSON.parse(id_list.getList()).list;
b = [];
for (var i = 1; i < a.length; i++) {
b.push(a[i].value);
}

b;

// b has the list value

getList give you something like this
{"list":[{"value":"__##prompt##__","label":"Select an item"},{"value":"EUR","label":"EUR"},{"value":"USD","label":"USD"},{"value":"GBP","label":"GBP"}],"valueField":"value","labelField":"label","listField":"list"}

You can see that all items in the list are under JSON key "list".
Then, first item is system default for non-selected value, so you can start the "for" loop index from 1 (not 0).

Best regards,

Taka
Reply all
Reply to author
Forward
0 new messages