0

I want to extract the name of the file to another 6 columns.

For example, you want to put the "D" in the file name in the first column and the word "Berlin" in the second column, and so on.

I have already found a helpful solution with flows here in the forum, but I can't get any further with it.

I get the first part extracted, but it doesn't work from the second part on. I think I have a mistake in the definition of the formula/expression of the flow.

I hope you could help me.

Here are the steps I have done so far.

As you can see, the first five columns have " - " as delimiter and the last one only "-":

enter image description here

This my flow:

enter image description here

And here you will get the formula for part 1 (works) and 2 (doesn´t work):

Part 1 (extract the "D"):

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

Part 2 (extract the "Berlin":

substring(triggerBody()?['{Name}'], add(IndexOf(triggerBody()?['{Name}'],' - '),1), sub(sub(length(triggerBody()?['{Name}']),IndexOf(triggerBody()?['{Name}'],' - ')),1))

1 Answer 1

0

You can use Compose action and Split function to extract the Filename string into substrings using the delimiter ' - '.

See the sample flow here: enter image description here

And the expressions are:

Compose: split(triggerOutputs()?['body/{Name}'],' - ')

D: outputs('Compose')[0]

Berlin: outputs('Compose')[1]

Note: Since you do not need the last substring “2020-q*”, I have left it un-splitted.


UPDATE:

To extract substrings from "2020-q*", you can add one more Compose action and two outputs from the second Compose action to the flow:

enter image description here

Expressions:

Compose2: split(outputs('2020-q*'),'-')

2020: outputs('Compose2')[0]

q*: outputs('Compose2')[1]

4
  • Thanks for your help. That worked really well! Do you still have a solution if I want to split "2020-q*" also? Jan 25, 2021 at 9:19
  • @Ann-KathrinKaiser Please see the updated answer. Jan 25, 2021 at 9:35
  • Thank you for your support! Jan 26, 2021 at 15:23
  • @Ann-KathrinKaiser Glad it helps. Would you please accept it as answer if you later confirm it to be the solution? It will help others in this forum to find answers quickly as well. Jan 27, 2021 at 1:18

Your Answer

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

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