Append period in stead of comma to the last item in a repeated compontent

Hello,

In my app I get a list of tags from an api without formatting. I use a repeated paragraph to show them horizontally. Because I want the tags seperated by a comma “,” I use a formula to append the comma to the tag. The result is: “tag1, tag2, tag3,”
Now after the last tag in the list I want to append a period “.” in stead of a comma, so the result is: “tag1, tag2, tag3.”
Any suggestions? Thx!

Hey there!

One way to do this is to add the following IF formula function to your formula:

current.tag + IF(INDEX_OF(data.List, current) == COUNT(data.List)-1, ". ", ", ")

This formula checks if the current tag is the last item in the list according to its index. If it is, then a period is appended, in other cases a comma is appended. It’s not the most beautiful formula, but it should work :grin:

1 Like