
Announcements
I can't see the difference between these two expressions.
I started with the first expression failing due " 'substring' parameters are out of range", but I thought the if condition would make it skip the first condition and therefore not evaluate it. Strangely the second expression works.
If(contains(body('Html_to_text'),'-::-::-::-'),substring(body('Html_to_text'),0,indexOf(body('Html_to_text'),'-::-::-::-')),body('Html_to_text'))
substring(body('Html_to_text'),0,If(contains(body('Html_to_text'),'-::-::-::-'),indexOf(body('Html_to_text'),'-::-::-::-'),length(body('Html_to_text'))))As I said it works now, but I am just curious.
N
EDITED: there was a ) missing at the end of the second expression when I copied it
2nd Edit: Sorry I made a mess in copying the second expression. now it is correct and it works. working late at might ...
Hi nsgma,
Please take this doc about workflow definition language for a reference:
https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language
From the doc we know that:
Substring will return subset of characters from a string.
IndexOf will find the index of a value within a string case insensitively.
Length will return the number of elements in an array or string.
Contains will return true if dictionary contains a key, list contains value, or string contains substring.
I assume that you want to use the function to return subset of characters from a string, you may need to configure the function to something likes “substring('somevalue-abc-somevalue',10,3)”. The if function will return the values for Start index and Length.
While if you use the first function, it will not return values for Start index and Length. So the function won’t work.
Hope it could be a reference for you.
Best regards,
Mabel Mao