Here is what I would do
Initialize a variable (array)
initialize it using Split(the answer) for Material code
Initialize a variable (array)
initialize it using Split(the answer) for Material Due
Now use an Apply to Each, with the Material Code Array as the Input
Now let me explain the next part, its not hard but
You have two arrays
they are going to have the same IndexOf values since they are the same size
So when you are looping through the Material Code Array, you will use, in a Compose
indexOf(variables('MyMaterialCodeArray'), item())
This will return the Index # of the current value of Material Code. Why do we want that? Because we need to get the Matching IndexOf (ordinal position value of the Material Due date) from the Material Due array
Once you have the value of the current Material Code Index in the Array, you can use THAT # to get the matching Index Due date by adding another compose and typing
variables('myDueDateArray')[int(outputs('Compose_Name_where_you_got_IndexOf'))]
So image like this
You have an array with
["100", "200","300"]
and
["Date1","Date2","Date3"]
you split the top array in your Apply to Each
So iteration 1, is 100, then 2 is 200 and 3 is 300
while you iterate, inside the apply to each you say
indexOf(variables('MyMaterialCodeArray'), item())
which is indexOf(variables('MyMaterialCodeArray'), "100") in the first iteration, which returns a 0, for its Ordinal Position aka index in the array
in your next compose
variables('myDueDateArray')[int(outputs('Compose_Name_where_you_got_IndexOf'))]
turns into
variables('myDueDateArray')[0]
which returns Date1 in the first iteration
And so on
Make sense?
If these suggestions help resolve your issue, Please consider Marking the answer as such and also maybe a like.
Thank you!
Sincerely, Michael Gernaey