cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Boynogs123
Frequent Visitor

Dynamically checking if there is a null array value

Hi everyone,

 

Is there a way to check the array if there is a null value like the picture below?

Dynamically checking if there is a null value.

Boynogs123_0-1644994954505.png

 

Thank you and best regards,

 

Boynogs123,

 

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @Boynogs123,

 

You could probably use xpath for this with a text function. Convert it first to xml to be able to do this.

 

Below is an example.

 

1. Add a Select action. Use the expression below for the From field.

This expression converts the outputs of the compose into xml and finds the nodes which are empty with xpath.

xpath(xml(json(concat('{"Columns":',string(outputs('Compose')), '}'))), '//Columns/*[not(text())]')

 

2. Switch the Map field to text mode. Use the expression below.

This expression converts the content back into readable column names. You should get an array with column names which are empty.

substring(base64tostring(item()['$content']), 1, sub(indexOf(base64ToString(item()['$content']), '>'),3))

 

xpath_empty.png

 

Test should look something like this:

 

outputxpath_empty.png

 

Kudos to @Paulie78 for this approach. He showed me this back in August last year. Xpath can be very useful sometimes 😁

View solution in original post

2 REPLIES 2
Expiscornovus
Super User
Super User

Hi @Boynogs123,

 

You could probably use xpath for this with a text function. Convert it first to xml to be able to do this.

 

Below is an example.

 

1. Add a Select action. Use the expression below for the From field.

This expression converts the outputs of the compose into xml and finds the nodes which are empty with xpath.

xpath(xml(json(concat('{"Columns":',string(outputs('Compose')), '}'))), '//Columns/*[not(text())]')

 

2. Switch the Map field to text mode. Use the expression below.

This expression converts the content back into readable column names. You should get an array with column names which are empty.

substring(base64tostring(item()['$content']), 1, sub(indexOf(base64ToString(item()['$content']), '>'),3))

 

xpath_empty.png

 

Test should look something like this:

 

outputxpath_empty.png

 

Kudos to @Paulie78 for this approach. He showed me this back in August last year. Xpath can be very useful sometimes 😁

BrunoLucas
Frequent Visitor

Hi,

where is this array at? is the input? returning data from a query? or is it from a array variable?

you can test if the entire array is empty, like :

BrunoLucas_1-1645003122312.png

 

 

But to pick if a random field is empty you will need to loop and test like this 

 

BrunoLucas_0-1645003014689.png

 

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.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

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.

Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022- Season 2 has kicked off!

Users online (4,124)