Found set field contents in array?

This is probably pretty easy, but I can’t seem to figure out the right command or syntax…

I want to get a list of a certian field’s contents for a found set of records.

F’rinstance, with a found set like this:

ID Name
01 Cain
02 Johan
03 Jan

I might want to return all the ID’s as 01|02|03, or all the names as Cain|Johan|Jan.

I know how to convert an array into this format, but not how to get a single foundset dataprovider into an array. Or perhaps I can skip over array and go straight to the end result?

Like I said, there’s probably a nice straight command for this, but darned if I can find it. :(

Hi Cain,

Under Database Manager node there is the function : getFoundSetDataProviderAsArray

//Returns a foundset dataprovider (normally a column) as JavaScript array
var array = databaseManager.getFoundSetDataProviderAsArray(foundset,'order_id');

There is also a javaScript function called ‘Join’ which allows you to specify the Array to join and the delimiter to use and this will return a string from that array.

This function is part of the Array node in version 2.1.2 so I am not sure whether it is valid in earlier versions if invoked, but you could still perform the concatenation with a loop through the array elements anyway.

Cheers
Harry

Awesome! Thanx again, Harry!

Awesome! Thanx again, Harry!

btw:

The join function worked in prior versions, there just wasn’t a convenient node for them.

I didn’t even see the getFoundSetDataProviderAsArray. I was looking in all the sub-nodes, and never looked at the actual DatabaseManager node! :oops: