cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Substring until a comma character failing

Hello, 

 

Making a system for extracting the text from the body of an automated email. 

 

I want to extract just specific values of strings from it, i have made this before, but right now I'm experiencing some trouble. 

I would like to extract the text between the 'Assigned By:' and the comma (',')

 

Part of the text I would like to extractPart of the text I would like to extract

 

I am using the following expression: 

 

substring(body('Html_to_text'),add(lastIndexOf(body('Html_to_text'),'Assigned By: '),13),sub(indexOf(body('Html_to_text'),','),add(indexOf(body('html_to_text'),'Assigned By: '),13)))

And this returns the following error: 

 

image.png

It's apparently not detecting the comma (',') value. I know that because I tested enterin '09/' value instead of ',' and it returned: 

 

image.png

So the expression does work, it is receiving a correct parameters and so. It is just that it isn't detecting the comma value, how can I achieve this?

 

Thanks. 

LG

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User
Dual Super User

Re: Substring until a comma character failing

@LuisGuzman98 

 

Here is the full solution

https://github.com/rdorrani/Microsoft-Flow/blob/master/FetchstringfromSampletext_20190925204900.zip

This one fetches the line item and the word from that specific line item

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

View solution in original post

9 REPLIES 9
Highlighted
Dual Super User
Dual Super User

Re: Substring until a comma character failing

Hi @LuisGuzman98 

 

Use expression

split(split(body('Html_to_text'),',')?[0],':')?[1]
 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Highlighted
Helper II
Helper II

Re: Substring until a comma character failing

Hey thanks for the reply 

@RezaDorrani 

 

Didn't worked, copy pasted and assigned the expression to the value field; no value returned. 

 

image.png

Weird, using my actual expression is there any solution? Another way of stating there is a comma character?

 

Highlighted
Dual Super User
Dual Super User

Re: Substring until a comma character failing

@LuisGuzman98 

 

I tested this with exactly the same string as yours and it worked

Make sure the expression you updated is reflected in the flow- sometimes it does not update it

 

 

Highlighted
Helper II
Helper II

Re: Substring until a comma character failing

@RezaDorrani 

 

Email content is outputted correctly. 

 

image.png

yeap, even I deleted the last exression and created a new one for making sure it was updated. 

image.png

I really don't know what could be. 

Highlighted
Dual Super User
Dual Super User

Re: Substring until a comma character failing

@LuisGuzman98 

 

what is the data type of this variable?

 

can u try the same expression in a compose action

Highlighted
Helper II
Helper II

Re: Substring until a comma character failing

The variable is a String. 

 

I tried: image.png

 

It does not show anything:image.png

 

After that I also tried to first compose the plain text of the email, the html to text output. then assigning the output to a variable called email text, then used the expression but as a parametter I supply the variable. Same result. Could it be that the email contain maybe too many characters?? Or lots of ',' and ':'? 

 

 

 

 

Highlighted
Dual Super User
Dual Super User

Re: Substring until a comma character failing

Hi @LuisGuzman98 

 

How will it work - your html to text has many more strings and not just the string you mentioned when you first posted this message

 

Does the html to text output have new line characters in it?

 

 

Highlighted
Dual Super User
Dual Super User

Re: Substring until a comma character failing

@LuisGuzman98 

 

Here is the full solution

https://github.com/rdorrani/Microsoft-Flow/blob/master/FetchstringfromSampletext_20190925204900.zip

This one fetches the line item and the word from that specific line item

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

View solution in original post

Highlighted
Helper II
Helper II

Re: Substring until a comma character failing

@RezaDorrani 

 

Thanks for the help, I manage it through the following way:image.png

I compose the whole string from assigned by until subject and assigned that output to a variable. 

Then I splited that variable by a comma, and it worked. 

 

I could done that with just one variable, but i don´t know how to pull the output from the compose actions 😛 But i do know how to pull the variables through 'variables()' .

 

Thanks.  

 

 

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (5,299)