Reputation: 957
I was trying to remove last character(comma) from my variable Images in power automate using compose action as below using expression.
if(endsWith(variables('Images'), ','), substring(variables('Images'), 0, length(variables('Images')) - 1), variables('Images'))
But when I click OK button in expression it always saying "The expression is invalid". but I don't know what is the problem there. Below is flow image.
Upvotes: 0
Views: 276
Reputation: 11262
Yeah, you can't do something - 1
, it's all expression based so you need to use the sub()
function.
This will work for you ...
if(endsWith(variables('Images'), ','),
substring(variables('Images'), 0, sub(length(variables('Images')), 1)),
variables('Images')
)
Upvotes: 1