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

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

Users online (1,115)