cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DanielRK
Super User
Super User

Checkboxes in gallery not resetting when a new form is created

Hi,

 

I have Checkboxes nested in a gallery which are not resetting when a new form is created (values from previous submission remain).

 

The settings for the datacard in which the gallery is nested are:

 

Default: ColCategoryData

Update: ColCategoryData

 

This is the collection created and modified by clicking the Check button.

 

Check button properties:

Oncheck: Collect(ColCategoryData,ThisItem);

Onuncheck: Remove(ColCategoryData,ThisItem);

 

In order to reset the check boxes I have put in the following formula for the "onvisible" property for the screen containing the new form:

 

Clear(ColCategoryData);

 

But it's not clearing the checkboxes. What have I done wrong?

 

Thanks a lot!

 

Regards,

 

Dan

2 ACCEPTED SOLUTIONS

Accepted Solutions
JR-BejeweledOne
Super User
Super User

Your checkbox isn't actually using any data from the collection, so clearing the collection won't cause it to reset.

 

Here is how to fix that.   On App start set a variable to false and add the variable in the Reset attribute of the checkbox.

 

Reset: varXXX

 

In your onVisible of the screen do this:   Set(varXXX, true); Set(varXXX, false)

 

It's important that you do both commands.  The reset attribute requires a true/false value.    The value only needs to be true long enough for the control to reset and then should be false



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

View solution in original post

DanielRK
Super User
Super User

Hi @JR-BejeweledOne ,

 

Thanks for all your help. I managed to find the solution.

 

The default property of the check box should be ThisItem.Value in colCategoryData.Value.

 

You are right it is a custom solution I found on youtube and it was in the comments section.

 

Thanks again.

 

Regards,

 

Daniel

View solution in original post

15 REPLIES 15
JR-BejeweledOne
Super User
Super User

Your checkbox isn't actually using any data from the collection, so clearing the collection won't cause it to reset.

 

Here is how to fix that.   On App start set a variable to false and add the variable in the Reset attribute of the checkbox.

 

Reset: varXXX

 

In your onVisible of the screen do this:   Set(varXXX, true); Set(varXXX, false)

 

It's important that you do both commands.  The reset attribute requires a true/false value.    The value only needs to be true long enough for the control to reset and then should be false



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

View solution in original post

DanielRK
Super User
Super User

Hi @JR-BejeweledOne ,

 

You are a genuis. It worked like a bomb!

 

Thank you Thank you!

 

Regards,

 

Daniel

Hi @JR-BejeweledOne ,

 

I'm using the same form in edit mode to edit the item as when it's in new mode to capture a new item. Now when I create a new item and go to view it in view mode and also try to edit the form in edit mode, the check boxes retained their checks which is good, however if I go create a new item after that the check boxes are blank which is great but when I go back to my gallery and open the previously created item, the value is still correct in view mode but when I open the item to edit it, the check box has been changed to the value of the record I captured after this one? 

 

How do I get the check box to retain it's value in edit mode if I'm using the same form for both creating new items and editing prior ones?

 

Thanks a lot!

 

Daniel 

JR-BejeweledOne
Super User
Super User

What is the default property for your checkboxes on the form?



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
DanielRK
Super User
Super User

Hi @JR-BejeweledOne ,

 

It's false.

 

Regards,

 

Dan

JR-BejeweledOne
Super User
Super User

Try setting it to Parent.Default



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

Hi @JR-BejeweledOne ,

 

Still not winning:

 

DanielRK_0-1615215024023.png

 

DanielRK_1-1615215051482.png

 

DanielRK_2-1615215069978.png

 

Sorry to trouble you. Thanks for your help on this.

 

Regards,

 

Daniel

 

 

JR-BejeweledOne
Super User
Super User

What is your forms Items property set to?



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
DanielRK
Super User
Super User

Hi @JR-BejeweledOne

 

Choices([@'CRM Surveys'].AccountQueries)

 

Thanks again.

 

Regards,

 

Dan

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,780)