I have an automation that examines the Labels field values and builds a string based on found labels (ultimately, I want to remove those labels). The first challenge is that if I find fewer labels than the total number of labels, I end up with a trailing comma at the end of my string that I want to remove.
So, I try to remove the last character from my string, as follows:
Smart Value: teamLabels (examines the labels field and builds up a string based on found values):
{{#labels}}{{#if(startsWith("team/"))}}{"remove": "{{.}}"}{{^last}} ,{{/}}{{/}}{{/}}Problem is that this can leave a trailing comma if there are additional labels. So, I try to remove it.
Smart Value: teamLen (gets the length of teamLabels - 1)
{{#=}}{{teamLabels.length()}}-1{{/}}Smart Value: teamLabelsTrim (returns teamLabels with the last char removed)
{{teamLabels.left(teamLen)}}I have tried multiple variations of the formula for teamLabelsTrim and either Automations can't parse it, or teamLabelsTrim comes back empty. I verified teamLabels and teamLen have appropriate values.