cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Questionasking
Helper III
Helper III

Visible If Statment. IsBlank

Hi,

 

In a standard three page app using forms, i have created a visible statement on a label that just displays some text saying you cannot have no information in one input box (a person datacard) or no info in another input box (Text input)

 

currently the code is 

 

If(IsBlank(AFmaintenancestaff.Selected.DisplayName) And IsBlank(AFmaintenancestaffother.Text), true, false)

 

and it works..

 

But shouldn't i be using Or or || ? which does then not work, because in my mind the statment above says they both have to blank for the label to show? 

 

Im a little confused? could someone set me straight?

 

 

 

13 REPLIES 13
Digital
Continued Contributor
Continued Contributor

You're correct. Maybe double check the fields you're referencing. Tested this below and logic is correct.

 

IsBlank("") And IsBlank("") // true

IsBlank("Something") And IsBlank("") // false

IsBlank("") And IsBlank("Something") // false

IsBlank("") Or IsBlank("") // true

IsBlank("Something") Or IsBlank("") // true

IsBlank("Something") Or IsBlank("Something") // false

 

K-A-R-L
Solution Specialist
Solution Specialist

Hi @Questionasking ,

Your code should work if you change the operator to OR / ||

If(IsBlank(AFmaintenancestaff.Selected.DisplayName) || IsBlank(AFmaintenancestaffother.Text), true, false)

 

Can you just make sure that your  "AFmaintenancestaffother.Text" doesn't have a Default() value.

 

K-A-R-L_0-1608694263742.png

 

----------------------------------------------------------------------------
Thanks,
K-A-R-L


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If you thought this post was helpful, please give it a Thumbs Up.

Thankyou K-A-R-L

 

It did have the default value of Parent.Default , curiously just for my own learning why did the "And" work and not "Or" work if the default has something in it?

RE: Are you using a form? If yes, it might retain the default value from a form submission, then your second statement would be false, that's why "Or" is not working or the text doesn't display.

You might need  to unlock the DataCard or the AFmaintenancestaffother.Text and remove the Default() value:

K-A-R-L_0-1608696062711.png

 

Can you please make sure that it has no default value or simply add double quotes as default "".

 

----------------------------------------------------------------------------
Thanks,
K-A-R-L


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If you thought this post was helpful, please give it a Thumbs Up.

 

Hi Karl the if statment is still not working? its referenced correctly, it only works if i use and? this has never happened before?

Hi @Questionasking ,

Please try this:

If(IsBlank(Gallery2.Selected.Title) = true || IsBlank(AFmaintenancestaffother.Text) = true, false, true)

No, still get the same issue. Its only working if i have and.. Heres some images of the it. I think i have a issue because have a look at this when i hover over the maintenancestaffother in the code box

FORONLINE3.png

 

heres proof of my issue, btw the issue is the same if i use 

 

If(IsBlank(AFmaintenancestaff.Selected.DisplayName) || IsBlank(AFmaintenancestaffother.Text), true, false)

 

of the = true 

 

FORONLINE.pngFORONLINE2.png

 

i think ill start a new thread about the control error im getting..

Digital
Continued Contributor
Continued Contributor

Don't worry about when you hover over maintenancestaffother. This is a data card so Power Apps is correct to list it as a control. If you highlighted the entire maintenancestaffother.Text  you will see the formula bar will display the data type which should be text.

 

I have run a test and the logic with the following code which works.

 

In the Visible property of the text label

 

IsBlank(MyTextBox.Text) Or IsBlank(MyPeoplePicker.Selected.DisplayName

 

Or you could try a different approach, but it's really the same thing.

 

If(
!IsBlank(MyTextBox.Text) Or !IsBlank(MyPeoplePicker.Selected.DisplayName,
false,
true
)

 

v-xiaochen-msft
Community Support
Community Support

Hi @Questionasking  ,

 

Happy holiday.

Could you tell me:
Has the problem been solved?
Is there anything else I can help?

 

Best Regards,
Wearsky

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,088)