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

Consistently get a value from array

Hi guys,

 

I need some help. I need to get an email value from a JSON array consistently, but have no idea how to do it.

 

The array could look like this:

 

[
  "hihi@googlemax.edu.sg\"
]

 

 

 

or this, depending on whether the other attributes are present:

 

[
  "hihi@googlemax.edu.sg\",\"notApiConsumer\",\"webApp"
]

 

 

Is there any way I can consistently pull the email address from within this array?

I'm not sure I can use position ids since there could be other values within this array.

 

1 ACCEPTED SOLUTION

Accepted Solutions

on the left side: 

item()

on the right side:

string('@')

View solution in original post

12 REPLIES 12
Paulie78
Super User
Super User

Would there be any chance of the other array entries containing an @ symbol? If not it could be filtered on that.

Hello Paulie, there would not be any other array entries containing an @ symbol. Seek your guidance please!

Hello @Paulie78 , I would also like to mention that the domains of the email could be different.

 

In my example, I've put it as googlemax.edu.sg. However, in my environment, there are sub domains. Such as, visitors.googlemax.edu.sg, students.googlemax.edu.sg. This complication has me pretty stumped as I can't just split the string from @googlemax.edu.sg.

 

It should be straightforward, the part that makes it slightly tricky is that your array, only actually contains one value. The double quote marks are escaped, so it is an array with only 1 element.

Paulie78
Super User
Super User

You can do it like this:

2021-08-04_14-34-51.png

Hi Paulie,

 

Trying this out now. May I check what are the 2 expressions in your filter array action? Thanks!

on the left side: 

item()

on the right side:

string('@')

View solution in original post

Hey Paulie.

 

I can confirm this definitively works! Thank you!

Hey Paulie,

 

It's kinda weird. When I test this on a clean new flow, it works. However, when I implement this filter array action in my existing flow, the flow never finishes.

 

Any idea what might cause this?

Perhaps in your real flow, the array is actually an array, not a string like you posted in the initial message? I am guessing really.

Hi Paulie,

 

This is the actual output of the json.

 

      "tags": [
        "owner:hihi@googlemax.edu.sg",
        "notApiConsumer",
        "webApp"
      ]

 

 

I'm putting this content into a tag variable and executing your steps on it. If i initialize this tag variable as a string, the flow works but I don't get the email address. If I initialize this variable as an array, the flow times out.

TSYong_0-1628088754681.png

TSYong_3-1628089096481.png

 

TSYong_1-1628088849498.png

TSYong_2-1628088875414.png

Appreciate your help on this.

Edit: Add 1 more screenshot.

 

Hey Paulie,

 

Just wanna let you know that you're the best.

 

I managed to solve by it keeping the Tags variable as string, and using this expression to split the string instead.

split(variables('Tags'),'","')

You though, are the true rockstar 🤠.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,937)