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.

New Process Advisor Capabilities carousel.png

Read the blog for the latest news

Read the latest about new experiences and capabilities in the Power Automate product blog.

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.

AI Builder AMA June 7th carousel (up on May 25th, take down June 8th) (1).png

'Ask Microsoft Anything' about AI Builder!

The AI Builder team invite you to ask questions and provide helpful answers at our next AMA.

Users online (1,554)