Expand my Community achievements bar.

Do you have questions about the migration to Adobe Business Platform? Come join our upcoming coffee break and ask away!

Return index number using map array function

Avatar

Level 3

Hi All

Quick question

Often i have a need where i would like to use the Map function to identify certain objects meeting the filter criteria i set.

 

For instance: map([TASKS ARRAY];ID;categoryID;<CATID TO SEARCH>)

 

This works fine to retrieve that task ID, but most of the time i would like to pick a few more fields for onward processing. Ideally i would use the get function but in order to do this I would need to know the index number of those returned items within the array.

 

Is there a way to use the map function to retrieve the index number? I'm sure we used to be able to to do this in the previous version of fusion....

 

Thanks

 

 

1 Reply

Avatar

Level 5

I've done something similar to this using the following type of technique:

 

Screen Shot 2023-07-28 at 6.30.17 PM.png

I've attached a blueprint that should show you how to do it.  But in short:

  1. Init your array using something like add(emptyarray; a; b; c)
  2. Create your indices using a Repeater from 0 to length(array)
  3. Grab the element at index i using get(arrayi).