0

I am trying to create a automated flow which will copy the file name into a new column up until the first space in the name. For example:

The uploaded file name is **ZKAL12345-I RTR 123ml Product Label Region 61.PDF so i would like the column to be name ZKAL12345-I

I've found the below code, which works well, however, it stops the naming at the dash (-) and as i am sure you can still im not quite sure how to change it to the requirement above .

substring(triggerBody()?['{Name}'], 0, lastIndexOf(triggerBody()?['{Name}'],'-'))

Any help is appreciated.

Many thanks, Artur

1 Answer 1

0

Could you not just do

substring(triggerBody()?['{Name}'], 0, indexOf(triggerBody()?['{Name}'],' '))

?

indexOf() returns the first index of the searched for value, in this case, a single space, which in your case would be the space between "ZKAL12345-I" and "RTR".

1
  • Haha, Thank you. That worked. For some reason, I didn't remove the "last" when I tried it.
    – ArturDj
    Aug 14, 2020 at 8:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.