Expand my Community achievements bar.

Never miss an update of the Adobe Journey Optimizer Community Lens! Subscribe now to get the latest updates, insights, and highlights delivered straight to your inbox every time a new edition drops.
SOLVED

Position of value in ListString

Avatar

Level 5

I have a JSON file I'm using in a journey via Data Source (called DiasHabiles) and I need to find the position of an specific date:

Silvio6_0-1767135218732.png

 

so for example, I want the position of the date "2026-01-06" which is the position 2

 

The solution AJO gives is something like this: 
getListItem(#{DiasHabiles.diasHabiles.Fecha_Habil},0)

 

but I need to hardcode the position, and I want to find the position of an specific date in that list.

 

how can I achieve that? Thanks!

 

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

@Silvio6 You can validate it on the lines of the following expression 

toString((indexOf(serializeList([
"2026-01-02", 
"2026-01-05", 
"2026-01-06", 
"2026-01-07", 
"2026-01-08",
"2026-01-09", 
"2026-01-12", 
"2026-01-13", 
"2026-01-14",
"2026-01-15",
"2026-01-16"], "", false),"2026-01-06"))/(length("2026-01-06"))) // Replace Individual Date and array fields with the respective XDM paths

 

View solution in original post

2 Replies

Avatar

Correct answer by
Employee Advisor

@Silvio6 You can validate it on the lines of the following expression 

toString((indexOf(serializeList([
"2026-01-02", 
"2026-01-05", 
"2026-01-06", 
"2026-01-07", 
"2026-01-08",
"2026-01-09", 
"2026-01-12", 
"2026-01-13", 
"2026-01-14",
"2026-01-15",
"2026-01-16"], "", false),"2026-01-06"))/(length("2026-01-06"))) // Replace Individual Date and array fields with the respective XDM paths

 

Avatar

Level 5

the key was in "/lenght", amazing solution. Thanks!