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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / if statement apply the...
Power Apps
Answered

if statement apply the wrong logic

(0) ShareShare
ReportReport
Posted on by 124

Good morning, following the suggestion from @Ashwin7104 in the post Solved: Re: Why isBlank it's true? - Power Platform Community (microsoft.com)

 

I've attempted to handle the Displaymode of three dropdownboxes with this check:

 

If(
IsEmpty(
Distinct(
Filter(
Automobili,
Assegnatario.Value = varUtente && Tipo_Veicolo.Value = "Furgone"
),
Title
)
),
Set(varTipo,true),
Set(varTipo,false)
)

 

unfortunately varTipo always comes false also when the isEmpty is True.

 

I'm missing something ? 😕

 

DPozzi_0-1656342096066.png

 

Categories:
I have the same question (0)
  • AJ_Z Profile Picture
    3,711 Super User 2024 Season 1 on at

    where does this formula get updates is it onselect or onchange of something or is it onvisible?

  • DPozzi Profile Picture
    124 on at

    @AJ_Z is in the screen onvisible

  • AJ_Z Profile Picture
    3,711 Super User 2024 Season 1 on at

    I am guessing you have tried to navigate away and back to the screen to refresh the onvisible? as it will only set when you first come to the screen? 🙂

     

  • DPozzi Profile Picture
    124 on at

    @AJ_Z yes I did multiple times, the syntax looks right to me, I really don't understand

  • AJ_Z Profile Picture
    3,711 Super User 2024 Season 1 on at

    It looks good to me 🙂

     

    Do either of the below options work?:

    If(
    IsEmpty(
    Distinct(
    Filter(
    Automobili,
    Assegnatario.Value = varUtente && Tipo_Veicolo.Value = "Furgone"
    ),
    Title
    ).Result
    ),
    Set(varTipo,true),
    Set(varTipo,false)
    )

     

     

    If(
    IsBlank(
    First(
    Distinct(
    Filter(
    Automobili,
    Assegnatario.Value = varUtente && Tipo_Veicolo.Value = "Furgone"
    ),
    Title
    )
    )
    ),
    Set(varTipo,true),
    Set(varTipo,false)
    )

     

     

     

     

    If(
    IsBlank(
    First(
    Distinct(
    Filter(
    Automobili,
    Assegnatario.Value = varUtente && Tipo_Veicolo.Value = "Furgone"
    ),
    Title
    )
    ).Result
    ),
    Set(varTipo,true),
    Set(varTipo,false)
    )​

     

    All of them work for my end 🙂 . Let me know how it goes

     

  • DPozzi Profile Picture
    124 on at

    @AJ_Z  no one works, they all behave in the same way of my first.. it's a non sense the isEmpty statement it's true, so why the variable is always "False"

  • MVP-Phipps Profile Picture
    3,521 Super User 2024 Season 1 on at

    My only thought is there variable is also being set somewhere else. Can you confirm this is the only place in the app where you are setting the variable?

     

    Please Accept as Solution if it solves your question. Or just give it a Thumbs Up if it is helpful as can help others.

    LinkedIn: https://www.linkedin.com/in/charlie-phipps-%F0%9F%91%A8%E2%80%8D%F0%9F%92%BB-91338715b/
    Subscribe to my YouTube: https://www.youtube.com/channel/UChmFBGU1YKIU91sNMQ7buGg

  • Verified answer
    DPozzi Profile Picture
    124 on at

    yes, if I remove this couple of "SET" the three dropdownboxes that use it in the display mode goes in error due the variable doesn't exist at all.

     

    I've solved in my app with a text label that report the kind of vehicle:

     

    Concat((SortByColumns(
    Distinct(
    Filter(
    Automobili,
    Title=SelTarga.Selected.Result),
    Tipo_Veicolo.Value
    ),
    "Result"
    )), Result & "")

     

     

    and then set the displaymode:

     

    If(
    IsMatch(
    TipoVeicolo.Text,
    "Furgone"
    ),
    DisplayMode.Edit,
    DisplayMode.Disabled
    )

     

    but this is just a walk around not a solution because this label it wasn't supposed to be showed and I don't like to "hide" labels just to use them as variables.

    in powerapps FX variables are always "boolean" doesn't them? if yes it's really a dumb thing

  • MVP-Phipps Profile Picture
    3,521 Super User 2024 Season 1 on at

    "display mode goes in error due the variable doesn't exist at all." have you tried setting the variable to false on the on app start or on the screen on visible property?

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard