cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gazzo1967
Impactful Individual
Impactful Individual

HELP what am i missing?? Visible label Condition

Hi All

I have a label that i would like to appear based on a condition

so my scenario is

i have to people selection Comboboxes

if they contain duplicate names the label should appear but it is appearing when both fields are empty.

my formula is

If(
DataCardValue8.Selected.DisplayName = DataCardValue7.Selected.DisplayName,true,
IsEmpty(DataCardValue8.Selected.DisplayName = DataCardValue7.Selected.DisplayName),false)

 

Is my logic flawed?

Help Gratefully received 🙂
Gary

1 ACCEPTED SOLUTION

Accepted Solutions

Hi Gary, I got this version to work on a test app - order of operations was biting us:

If(
    IsBlank(DataCardValue8.Selected.DisplayName) && IsBlank(DataCardValue7.Selected.DisplayName),
    false,
    DataCardValue8.Selected.DisplayName = DataCardValue7.Selected.DisplayName,
    true,
    false
)
_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

View solution in original post

12 REPLIES 12
BCLS776
Super User
Super User

Gary, do your combo boxes allow multiple selections? That's the default, and it creates a many-many relationship when you try to compare them. So, a simple "this = that" comparison doesn't work because "this" and "that" are both tables. Any chance you can turn off multiple selections for those, or even one? It would make the situation much easier to solve.

 

Bryan

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.
gazzo1967
Impactful Individual
Impactful Individual

@BCLS776 

Thanks for replying

No multiple selection is turned off
that was my thought too 😞
I think im in one of those its simple but i been at it soo long i can't see it scenario's lol
Gary

BCLS776
Super User
Super User

That's some good news! After a second look, I did notice a problem in your expression:

If(
DataCardValue8.Selected.DisplayName = DataCardValue7.Selected.DisplayName,true,
IsEmpty(DataCardValue8.Selected.DisplayName = DataCardValue7.Selected.DisplayName),false)

IsEmpty doesn't work with an expression as an argument. It expects a table.

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.
gazzo1967
Impactful Individual
Impactful Individual

@BCLS776 
Ah that makes sense!
But IsBlank wont work either 😞
Gary

Try this:

If(
    DataCardValue8.Selected.DisplayName = DataCardValue7.Selected.DisplayName,true,
    Len(DataCardValue8.Selected.DisplayName)<1 && Len(DataCardValue7.Selected.DisplayName)<1,false,
    false
)
_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.
gazzo1967
Impactful Individual
Impactful Individual

@BCLS776 

Nope

gazzo1967_0-1631216088075.png

my goal is that if the people selection is same show label but it shows when comboboxes are empty too 😞
Gary

Hmm, let's try IsBlank and see if we get somewhere with that one:

If(
    DataCardValue8.Selected.DisplayName = DataCardValue7.Selected.DisplayName,true,
    IsBlank(DataCardValue8.Selected.DisplayName) && IsBlank(DataCardValue7.Selected.DisplayName), false,
    false
)

Out of curiousity, are you getting the correct behavior when the same name is entered for the two candidates?

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.
gazzo1967
Impactful Individual
Impactful Individual

@BCLS776 

Yes it works perfectly with duplicate names but the label is visible when both fields have no selections
thats the part im having trouble with

I even tried this lol

If(
    Text(DataCardValue8.Selected.DisplayName) = Text(DataCardValue7.Selected.DisplayName) 
    ||!IsBlank(Text(DataCardValue7.Selected.DisplayName)) = !IsBlank(Text(DataCardValue8.Selected.DisplayName))
    
    ,true,
    false
)

this is going to be such a simple fix but i cant see it 😞

BCLS776
Super User
Super User

This is strange. Those should be empty strings, but they aren't acting like it. A couple more options:

 

If(
    DataCardValue8.Selected.DisplayName = DataCardValue7.Selected.DisplayName,true,
    Len(DataCardValue8.Selected.DisplayName & DataCardValue7.Selected.DisplayName)<1, false,
    false
)

 

If(
    DataCardValue8.Selected.DisplayName = DataCardValue7.Selected.DisplayName,true,
    And(IsEmpty(DataCardValue8.Selected), IsEmpty(DataCardValue7.Selected)), false,
    false
)
_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,449)