cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BClouded
Helper IV
Helper IV

Parse JSON of a SharePoint Choice field, Problem If empty

Hi Community

I'm trying to parse some values from PowerApps to an Excel Table.
Most of it works, but when a choice field is empty it gives an error that it cannot find the value.
I tried the change the code in the Add a row into a table action like this:
If Secteur is empty -> " None Selected", else give me the value.

if(empty(items('Apply_to_each_2')?['Secteur']),"None Selected",items('Apply_to_each_2')?['Secteur']['Value'])

but it's not working. Any idea what i'm doing wrong here? 

Thanks a lot!
Bart

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Dual Super User
Dual Super User

Hi @BClouded,

 

I think you are using the Secteur field instead of the Secteur Value field.

 

Can you try and use the expression below:

if(empty(items('Apply_to_each_2')?['Secteur/Value']), 'None Selected', items('Apply_to_each_2')?['Secteur/Value'])

 

View solution in original post

3 REPLIES 3
Expiscornovus
Dual Super User
Dual Super User

Hi @BClouded,

 

I think you are using the Secteur field instead of the Secteur Value field.

 

Can you try and use the expression below:

if(empty(items('Apply_to_each_2')?['Secteur/Value']), 'None Selected', items('Apply_to_each_2')?['Secteur/Value'])

 

Thanks a lot, it's working now!
i didn't knew you could also reference to the value with /Value

Expiscornovus
Dual Super User
Dual Super User

To be clear, that's only the syntax for a choice field 🙂

 

Normally a choice field value would be something like below. So, basically you are retrieving the value property of the choice field value 😉

 

"Secteur": {
      "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
      "Id": 0,
      "Value": "A"
}

 

 

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 (3,418)