cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
marial16
Post Partisan
Post Partisan

trim or replace variable

Hallo,

 

i am setting a variable initialized as array. The value i am getting is

 

[

{

"EMail": "myEmail@demo.com",

"Title":"my Email",

"Name":"i:0#.f|membership|mymail@demo.com"

},

{

"EMail": "mySecondEmail@demo.com",

"Title":"my Second Email",

"Name":"i:0#.f|membership|mysecondmail@demo.com"

}

]

 

Is there a way i can trim the Name property so i can keep only the red highlighted value??

I only want mymail to be the Name property

1 ACCEPTED SOLUTION

Accepted Solutions
abm
Super User
Super User

Hi @marial16 

 

Use the replace expression

 

replace(string(outputs('Compose')),'i:0#.f|membership|','')
 
image.png
 
Expression I used above is
 
replace(string(outputs('Compose')),'i:0#.f|membership|','')
 
 
 

 

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

View solution in original post

3 REPLIES 3
abm
Super User
Super User

Hi @marial16 

 

Use the replace expression

 

replace(string(outputs('Compose')),'i:0#.f|membership|','')
 
image.png
 
Expression I used above is
 
replace(string(outputs('Compose')),'i:0#.f|membership|','')
 
 
 

 

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
abm
Super User
Super User

Hi @marial16 

 

I have extended the flow to read the contents. Here it is

 

image.png

image.png

 

Parse JSON Schema is as follows:

 

{
    "type""array",
    "items": {
        "type""object",
        "properties": {
            "EMail": {
                "type""string"
            },
            "Title": {
                "type""string"
            },
            "Name": {
                "type""string"
            }
        },
        "required": [
            "EMail",
            "Title",
            "Name"
        ]
    }
}
 
Here is my run result:
 
image.png
 
Above in my test I have mapped only one property (EMail) under the Apply to each loop. You can use EMail, Title or Name here.
 
Thanks


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
KvB1
Solution Sage
Solution Sage

You can also use the select action and enter an expression in the value for Email field where you use a replace function, that way you can avoid the apply to each loop and keep your flow more efficient

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Users online (1,920)