acesario
5 years agoContributor II
How to identify matching values to create sequence numbers?
Looking for a function to help add sequence numbers to a json array. End goal is to apply a sequence to matching values, starting with 01, subsequent values get a sequence of 02…03… 04 etc. I could...
- 5 years ago
@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]