web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

empty(variables('var')) is equal to true - returns incorrect values... sometimes

(0) ShareShare
ReportReport
Posted on by

Basic overview:

Getting values from excel spreadsheet to put into a sharepoint list, but I need to check if the value is null, otherwise the list (i.e. the column Person / Group) throws error and doesnt add the entry.

 

So - I created the variable "OwnerField" which gets populated with a persons name, but on occassion, there is no person - so I have a condition to see if that variable is empty > condition Yes or No - if true, then populate with "No user assigned" if false, then it has a value - which is that variable's value.

 

This works - until it doesnt. 😞

 

E.g. My variable input is blank, but my condition is false.  The next entry, my variable input is blank, but my condition is true.  (see attached) 

 

Value 7 is correct! it satisfies condition with result true, and then pastes in as expected

 

CaptureValue7.PNG

 

Value 6 is not correct - its blank, but still satisfies false

CaptureValue6.PNG

 

Any help is greatly appreciated

I have the same question (0)
  • eliotcole Profile Picture
    4,339 Moderator on at
    Re: empty(variables('var')) is equal to true - returns incorrect values... sometimes

    Have you tried placing a second row in the condition, @Anonymous?

     

    So one row with nothing in the right side, and the second with the expression:

    null

    Then ensure it's an OR expression.

     

    However you could avoid using an Apply to each by setting OwnerField from INPUT_VALUE using this expression:

    if(
     or(
     equals(
     INPUT_VALUE, 
     ''
     ), 
     equals(
     INPUT_VALUE, 
     null
     ), 
     empty(
     INPUT_VALUE
     )
     ), 
     'No user assigned', 
     INPUT_VALUE
    )

     

    Below I've got examples of both approaches, the longer expression inside a Select to avoid any loops.

    example.jpg

    I realise that my sample data, and what I'm filling my OwnerField with may not be what you're doing, but that's irrelevant, essentially you can get done what you want using this approach. 🙂

     

    Each way works, and the Select produces a nice little set of data to boot 🙂:

    [
     {
     "inputValue": "",
     "OwnerField": "No user assigned"
     },
     {
     "inputValue": null,
     "OwnerField": "No user assigned"
     },
     {
     "inputValue": "frank",
     "OwnerField": "frank"
     }
    ]

    👍

  • Community Power Platform Member Profile Picture
    on at
    Re: empty(variables('var')) is equal to true - returns incorrect values... sometimes

    Hi eliotcole,

     

    Thank you for your time and reply - I will give this a shot and let you know! thanks again!😀

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 691 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 431 Moderator

#3
developerAJ Profile Picture

developerAJ 266

Last 30 days Overall leaderboard