cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Advocate II
Advocate 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

@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
Dual Super User II
Dual Super User II

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

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?

 

@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

 

 

@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. 

@LuisGuzman98 

 

what is the data type of this variable?

 

can u try the same expression in a compose action

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 ':'? 

 

 

 

 

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?

 

 

@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

@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
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (18,650)