Help with converting a collection to an array in Fusion | Community
Skip to main content
New Participant
June 21, 2023
Question

Help with converting a collection to an array in Fusion

  • June 21, 2023
  • 1 reply
  • 2492 views

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

1 reply

ChrisStephens
New Participant
June 22, 2023

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).

Anh2Author
New Participant
June 30, 2023

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