Index using map() and array.map()

Hello,
Is there a possiblity to know and use the current index during an iteration in the map() functions?

For example I want to use it as a new column:

b = a |> array.map(fn: (x) => ({_value: x, index: ????}))

If someone has the solution, my ultimate goal is to expand one record with an array into several records on the primitive type. For example:

|_time | _value (string)|

|— | —|

|2021-01-01T00:00:00Z | [1, 2, 3, 4]|
|2021-01-01T00:00:10Z | [10, 20, 30, 40]|

into:

|_time | _value (int)|serie|

|— | — | —|

|2021-01-01T00:00:00Z |1|0|
|2021-01-01T00:00:00Z |2|1|
|2021-01-01T00:00:00Z |3|2|
|2021-01-01T00:00:00Z |4|3|
|2021-01-01T00:00:10Z |10|0|
|2021-01-01T00:00:10Z |20|1|
|2021-01-01T00:00:10Z |30|2|
|2021-01-01T00:00:10Z |40|3|

Thank you

Hello @dambsst,
Unfortunately there isn’t a way to do this with flux. :frowning:

Hello @Anaisdg,

Thank you for your reply