cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JorgeGBS
Frequent Visitor

Filter just the email from this string

Morning guys,

I just convert the email variable array to a string variable, but when I try to put the string variable on the email action, this return me the datas like this, how can I filter just what are inside the "email":"jorge@xxx.com"

JorgeGBS_0-1665142814713.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Sundeep_Malik
Community Champion
Community Champion

Hey @JorgeGBS 

Try this:

Initialize a string variable. Then add an apply to each and pass the outputs where you are just getting the emails. And append to string the current item like this: items('Apply_to_each')?['email']

And also add a semi colon at the end so that you are able to separate them and directly add it to send email action.

Sundeep_Malik_0-1665146971343.png

 

Sundeep_Malik_1-1665146985741.png

 

View solution in original post

8 REPLIES 8
srduval
Super User
Super User

Where are you getting the email string from? It might be possible to run it through a parse JSON before converting to a string to get what you need. 

 

However if what we see is all you have to work with, you'll want to split the value using a split expression in a compose card. something like split(emailstring,';') this will split on the semicolon separating each line. Then you'll have to add an apply to each with the value being the output of the above split. Then inside the loop you'll want to do a replace on the output of that to strip off all the extra text and then you can send your email with the simple email address. if you want to send to all emails at once, you'll want to append the cleaned emails to a string variable separated by a semicolon

JorgeGBS
Frequent Visitor

Hello,

I'm extracting from a table in the Power BI

JorgeGBS_0-1665145727170.png

And I put in the join action, to transform into a string

JorgeGBS_1-1665145775467.png

 

But, when I put this result in the e-mail, don't send for anybody because are in this weird format {"email":"user@email.com"} 

 

Sundeep_Malik
Community Champion
Community Champion

Hey @JorgeGBS 

Try this:

Initialize a string variable. Then add an apply to each and pass the outputs where you are just getting the emails. And append to string the current item like this: items('Apply_to_each')?['email']

And also add a semi colon at the end so that you are able to separate them and directly add it to send email action.

Sundeep_Malik_0-1665146971343.png

 

Sundeep_Malik_1-1665146985741.png

 

JorgeGBS
Frequent Visitor

Hi @Sundeep_Malik 

This way you have said before, it's work and give to me this result

JorgeGBS_0-1665148250472.png

Now, how can I put this in email action, because when I try return me this

JorgeGBS_1-1665148287927.png

 

there's a way to split it in just one e-mail or put between the e-mails?

 

Sundeep_Malik
Community Champion
Community Champion

@JorgeGBS 

Just put the semi colon there, after appending each email in the variable. You can try split too, but that will just add one more action to your flow.

Adding a semi colon worked for me.

JorgeGBS
Frequent Visitor

@Sundeep_Malik 

I got it.
There's a way to exclude all the e-mails after the  ;  ? I want to send just one e-mail, but in this way is sent three e-mails

JorgeGBS_0-1665149347600.png

 

 

Sundeep_Malik
Community Champion
Community Champion

@JorgeGBS 

oh okay. So all the emails will be similar always?

Then split it and just send the value at 0 index.

Sundeep_Malik_0-1665149629355.png

split(variables('A'),';')
 
 
or before only, in the above compose, just get the value at 0 index. Then no need to append it to string variable.
 
JorgeGBS
Frequent Visitor

Thank you, my problem has been solved! Have a great day!

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (5,004)