Question
You have a canvas app that allows users to view, select, and purchase products. The app uses a Gallery control to display products and checkboxes that allow users to select products.
When users select items from the product catalog, they move to a different screen to complete a purchase.
Users must be able to clear all product selections when they click the button.
You need to configure the button.
What should you do?
- A. Use the Reload(Control) formula and pass the gallery control as parameter to the Reload formula.
- B. Use the Reset(control) formula and pass the checkbox to the formula to clear user selections.
- C. Set the OnCheck value to populate a collection and the OnUncheck value to remove the item from the collection. Clear the collection when the user selects the button. Correct
- D. Use the Revert(Products) formula and pass the checkbox to the formula to clear user selections.
- E. Use the Reset(Control) formula and pass the gallery control as a parameter to the Reset formula.
Explanation
Track the selections in a collection: the checkbox OnCheck adds the gallery item to the collection, OnUncheck removes it, and the checkbox Default checks whether the item is in the collection. The button then clears the collection with Clear, and every checkbox returns to unchecked because its Default no longer finds the item. The collection also gives the purchase screen the list of selected products. Reset cannot clear the checkboxes from the button: Microsoft documents that controls inside a Gallery cannot be reset from outside the gallery, so neither Reset on the checkbox nor Reset on the gallery clears the selections. Reload is not a Power Fx function, and Revert refreshes a data source and discards errors; it does not reset control values.