Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Help with converting a collection to an array in Fusion

Avatar

Level 1

Currently, I am getting a problem of referencing a specific element in a collection such as "1163:body.data" ("module-number.body:data") in Fusion.  Therefore, I need to convert a collection to an array so that I can use array functions to get specific elements.

 

Does anyone know how to convert a collection to an array in Fusion?

 

I really appreciate it!

 

Anh Ly-Hang

Vanguard Group

7 Replies

Avatar

Community Advisor

Can you include a screen shot of what your data looks like? I'm a little confused on what you are asking for, but I took my best guess below. If I'm wrong, data screen grabs could be useful to understand.

 

Collections and arrays are two different things. If you're just trying to pick something out of a collection, you don't need to use array tools, you can use the get command, which would look like get({yourCollection};{key}).

 

If you are saying you have an array of collections, and you need to drill down to the collection, you can use the iterator module on the array. If there's only 1 item in the array, you can use the get command also, get({yourArrayOfCollections};1).

Avatar

Level 1

Hi Chris,

 

Thanks very much for your shared expertise!  It will remember how to use it.

 

For this reported issue, I was able to figure out how to get data that I needed from different module, instead of from the collection "1163.body.data" which I tried different approaches before, but I could not get data from it.

 

I really appreciated your input!

 

Anh Ly-Hang

 

Avatar

Level 2

Hi Chris, I find this thread relevant so I am posting this question here. Please help.

 

ElanR1_0-1691163064948.png

I've used the iterator with target id and I've 9 bundles since that module and its good. But I am looking to create a variable for documentName and targetLanguage to be used in subsequent modules. 

 

As you said, I've used

ElanR1_1-1691163274457.png

But I am getting only the first collection repeated as below in all bundles. Please help!

ElanR1_2-1691163379254.png

 

Avatar

Community Advisor

Correct, you're essentially saying with your get statement, "Give me the first item in the Data Collection." If you are feeding Data into an iterator, then use the values coming out of the iterator, so for the document name, you'd map the documentName variable coming off of the iterator.

Avatar

Level 4

Hi Chris,

I'm trying to make use of the wisdom you shared here, to solve my current challenge, but I fail to get results.

I use the "Read a record" module to pull data about an issue record and the data includes the value of a Portfolio typeahead custom field. The output of the bundle looks like this:

tibormolnar_1-1741971579504.png

In the next "Set multiple variables" bundle I try to store the received ID in a variable:

tibormolnar_4-1741971949537.png

But no joy - the ID is not "extracted" from the collection (is it a collection at all?):

tibormolnar_3-1741971854953.png

I appreciate if you have the bandwidth to help with advise.

Thank you,

Tibor

Avatar

Level 8

Tibor,

Are you still having issues with extracting the ID?

I created a similar typeahead field in our sandbox environment and was able to extract the ID by inserting a Parse JSON module and creating a data structure:

KristenS_WF_0-1743709381444.png

KristenS_WF_2-1743709495058.png

Data structure:

KristenS_WF_1-1743709419994.png

I took the variable values from the Parse JSON module:

KristenS_WF_3-1743709563700.png

This allowed me to extract both the portfolio name and ID:

KristenS_WF_4-1743709626867.png

 

 

 

 

 

Avatar

Level 4

Hi Kristen,

thanks for the response.

What you described is exactly my current solution and it does work, yes.

However, I find this a bit cumbersome. I have multiple typeahead fields on the form and I need a separate JSON parse module for each of them. I was hoping that maybe there is another way that allows me to extract the IDs using function(s) in the value fields of the Set Variables module.

Tibor