Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Compose html - conditional (if a field is null or empty)?

(0) ShareShare
ReportReport
Posted on by

I have been using the following expression in a flow to include a <br> in html whenever a field did not have a blank or null value:

if(greater(length(items('Apply_to_each')['Address2ndLine']),0),'<br>','')

Now, however, the flow complains that the function "length" expects it's parameter to be an array or a string, not of type 'Null'.

I don't know if the function "length" has changed in its requirements.

 

Can anyone suggest a suitable replacement test for string vs null values?

  • BertP Profile Picture
    on at
    Re: Compose html - conditional (if a field is null or empty)?

    Perfect! Thank you so very much!

  • Verified answer
    v-chengfen-msft Profile Picture
    on at
    Re: Compose html - conditional (if a field is null or empty)?

    Hi @BertP ,

    Do you want to check if the content is empty?

    please try :

    If the content is empty, it is '', if not empty, it is '<br>'

    if(empty(items('Apply_to_each')['Address2ndLine']),'','<br>')

     

     

    If this post helps, then please consider Accept it as the solution to help the other members find it.

     

    Best Regards

    Cheng Feng

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 566 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 516 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 492