Forum Discussion
@acesario , you can also just add [0]
after @viktor_n’s expression.
$Records.map(record => record.Award.map((x, index) => record.Award.slice(0, index + 1).filter(y => y == x).length))[0]
And if you really need the “0” you can try and add .map(val => "0" + val)
So full expression is: $Records.map(record => record.Award.map((x, index) => record.Award.slice(0, index + 1).filter(y => y == x).length).map(val => "0" + val))[0]
@viktor_n , @j.angelevski
My initial testing worked with a limited record, however I’m noticing as I apply this to a more extended record structure, how the predicate of [0] impacts this. In this case, it always hits the first record, writing that result to each record. So if the first record has 2 awards, and the next has 5 it creates only two sequences on the second due to the [0]. Any ideas on how to define the predicate for the current record, rather than the first?