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 : HeKNe97Bv+CfaKo4ER7O0Z
Power Automate - General Discussion
Unanswered

Null vs Empty

Like (1) ShareShare
ReportReport
Posted on 11 Dec 2020 01:32:22 by 21

Hi,

 

I have a string variable that gets set to null by an action. According to the outputs the value shows as null.

 

Flow error 1.png

 

Flow error 2.png

When I put the following condition it always evaluates to true even though it should be false

 

Flow error 3.png

 

However, it I change the condition to:

 

empty(variables('email')) equals to false

 

Flow error 4.png

This evaluates correctly.

 

My question is why is this so and why can't we use the condition to check the string variable for null as it clearly is null.

When should we use null check and when should we use 'empty' check? 

I know for arrays is a difference between an empty array and null array.

But, clearly this string is a null value.

  • Gopala_Krishna Profile Picture
    1,491 on 11 Dec 2020 at 07:15:04
    Re: Null vs Empty

    @Stanza 

     

    That's true.

     

  • Stanza Profile Picture
    21 on 11 Dec 2020 at 04:12:26
    Re: Null vs Empty

    Never knew there was behind the scenes conversion for a string variable. In the world of C# programming a string that is assigned a null value is always null and not empty.

    This is confusing to say the least especially when the output says null but the backend is actually ''. 

     

    So am I right to suggest that we should use the null compare for field values and empty comparison for string variable values ?

  • Gopala_Krishna Profile Picture
    1,491 on 11 Dec 2020 at 02:02:20
    Re: Null vs Empty

    @Stanza 

     

    When ever you set the string variable to a null value Power Automate tries to convert it to a empty string.

    That's why your condition doesn't produce the expected output when you try to compare it with null value.

     

    Though you see null in the output it is actually an empty string and in the backend it is stored as "".

    When you use empty() it produces the expected result as the string is clearly empty.

     

    Please refer to the documentation for more insights regarding the same

    Reference guide for functions in expressions - Azure Logic Apps | Microsoft Docs

     

    If the information shared helps, please consider giving a thumbs up đź‘Ť and mark solution as resolved

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2