cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Rob_CTL
Level: Powered On

How to either return the value of a colum or return a specific text if empty?

Hi,

 

I have a simple Flow that pulls together a number of colums from a SharePoint list and puts them into a HTML table which gets emailed.  The issue I am hitting is one of these columns is a "choice" column and if the a user creates an item and doesn't select a choice from the list the Flow fails because the column doesn't contain anything.

 

 

What I am trying to achieve is if the column contains a value then that value is written to the HTML table, or if there is no value the Flow updates the HTML table with "Not Set" text.

 

 

Any help gratefully received.

 

Rob

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: How to either return the value of a colum or return a specific text if empty?

Hi @Rob_CTL,

 

I have made a test on my side and have create a "status" column with type "choice" in the sharepoint list.

 

The screenshot of the sharepoint list as below:

Capture.PNG

 

You could refer to screenshot below to create the flow:

Capture.PNG

 

Th expression for the status column as below:

if(empty(item()?['status']?['Value']),'Not Set',item()?['status']?['Value'])

The flow would run successsfully as below:

Capture.PNG

 

 

Best regards,

Alice

 

 

View solution in original post

3 REPLIES 3
ictmusings
Level: Powered On

Re: How to either return the value of a colum or return a specific text if empty?

I've come across null values myself lately. They can be frustrating. You can always check for a null value in a column with this formula to check for empty value: @empty(triggerBody()?['Name_Column/Variable']

 

To acheive what you want to do you need an if formula that checks if the column is empty. If the column is empty (evaluates to true) you can use a replace function. If the condition evaluates to false you do nothing.

 

Formula (I didn't fully test this, but can you try this)?

 

if(@empty(triggerBody()?['Name_Column/Variable'],replace(['Name_Column/Variable'],'Not Set'),'')

 

 

Community Support Team
Community Support Team

Re: How to either return the value of a colum or return a specific text if empty?

Hi @Rob_CTL,

 

I have made a test on my side and have create a "status" column with type "choice" in the sharepoint list.

 

The screenshot of the sharepoint list as below:

Capture.PNG

 

You could refer to screenshot below to create the flow:

Capture.PNG

 

Th expression for the status column as below:

if(empty(item()?['status']?['Value']),'Not Set',item()?['status']?['Value'])

The flow would run successsfully as below:

Capture.PNG

 

 

Best regards,

Alice

 

 

View solution in original post

Rob_CTL
Level: Powered On

Re: How to either return the value of a colum or return a specific text if empty?

Thanks @v-yuazh-msft and @ictmusings for the help, that worked perfectly!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,911)