cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
MelindaK
Level 8

BUG: Checkbox Visible property always false

Hi,

 

I have a checkbox inside a gallery with a formula set on the Visible property. Based on the Visible status of the checkbox I want to do some logic in the app.

Now, the formula in the property evaluates normally and it shows/hides my checkbox accordingly, but if I try to use checkbox.Visible in other formulas looks like it is always 'false', even when the checkbox is visible on the page.

 

In order to test this I have added a label on the page and I set it's Text property to checkbox.Visible. As you can see below, the checkbox is clearly visible on the page, but the value displayed in the label is 'false':

Screenshot_1.pngLabel value and checkbox visibleScreenshot_2.pngLabel formula

 

My problem with this is that I have to duplicate the formula from the Visible property, adding load on the app and duplicating code... hopefully this can be looked at and fixed in the next releases 🙂 

 

Thanks

MelindaK
7 REPLIES 7
Community Support Team
Community Support Team

Re: BUG: Checkbox Visible property always false

Hi @MelindaK,

 

I think this is because that your checkbox is placed in a data card in gallery control. Each card in this gallery will have a checkbox with different status and all of them are treated as checkbox in PowerApps. This is why your Label cannot show the right result with checkbox.Visible.

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
MelindaK
Level 8

Re: BUG: Checkbox Visible property always false

Hi @v-monli-msft

 

I am not using data cards... I am using a simple gallery with checkboxes in it. The label I was testing with was also part of the gallery. So I'm not sure I understand why is that correct, considering the checkbox is clearly visible on the page.

 

Thanks,

 

MelindaK
Community Support Team
Community Support Team

Re: BUG: Checkbox Visible property always false

Hi @MelindaK,

 

When you insert an control inside a Gallery, it will be inside a data cards. 

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
MelindaK
Level 8

Re: BUG: Checkbox Visible property always false

Hi @v-monli-msft

 

I'm sorry, but this still doesn't make any logical sense to me...

 

Since the PowerApp is capable of evaluating correctly the Visible formula on the checkbox, why is not able to use that value outside of the checkbox?

You can't have something clearly visible on the page, and when you use that property in another control to return 'false'...

MelindaK
Power Apps Staff tahoon
Power Apps Staff

Re: BUG: Checkbox Visible property always false

Hi MelindaK,

 

This seemingly strange behavior is because the Gallery is meant to display lists of items. The elements inside the gallery act as a template and are repeated for each item in the Gallery. To see what I mean, just insert a vertical Gallery.

 

Back to the case of the Checkbox. Let's say I insert a checkbox in the Gallery, name it ReviewCheckbox, and set Visible to a formula that evaluates to true for odd-numbered items and false for even-numbered items. Outside the checkbox, it's not really clear what ReviewCheckbox.Visible should be, because PowerApps does not know which instance of ReviewCheckbox to use. Is it the ReviewCheckbox of the first item or the second item, etc?

 

It would be a nice feature to prevent referencing Gallery elements from outside the Gallery. Or have a warning.

 

Meneghino
Level 10

Re: BUG: Checkbox Visible property always false

@tahoonis absolutely correct.

The correct way to reference controls in the gallery template should be either through the .Selected property, like this:

Gallery1.Selected.ReviewCheckBox.Visible

Or collectively like this for example:

Sum(Gallery1.AllItems, If(ReviewCheckBox.Visible, 1, 0))

 

However, this does not currently work, as only some of the properties of controls are available outside the gallery in this way.

 

Here is the work around:

  1. Create a blank app
  2. Insert a vertical gallery
  3. Insert a toggle, a check box and a label in the gallery's template
  4. Set the check box's Visible property to
    Toggle1.Value
  5. Set the label's text property to
    Ckeckbox1.Visible
  6. Insert a label outside the gallery and set its text property to this
    Sum(Gallery1.AllItems,If(Label1.Text="true", 1, 0))

That is all you need, screenshot below, please let me know what you think.

 

__.JPG

MelindaK
Level 8

Re: BUG: Checkbox Visible property always false

Hi guys,

 

Thanks for the explanation, it somehow makes more sense now.

The reason why I was confused is that the formula which hides/shows the checkbox validates the same for all the checkboxes in the gallery, so it's not the case when 1st is visible and 2nd is not... is all of them, or none of them.

 

I have ended up just duplicating the formula outside the gallery... not the best solution but it works.

 

However, @Meneghino nice solution 🙂 I haven't give it a try, but I believe it definitely works.

MelindaK

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,997)