Exam PL-200 All QuestionsBrowse all questions from this exam
Question 74

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?

    Correct Answer: D

    To clear all product selections in a Gallery control when a button is clicked, you should use a collection to manage the selected items. The OnCheck property of the checkboxes should populate a collection, and the OnUncheck property should remove items from the collection. When the user clicks the button, the collection should be cleared which will effectively reset the checkboxes to their default state, thereby clearing all product selections. This approach ensures that the state of the checkboxes within the Gallery is properly managed and reset.

Discussion
Kalki602Option: D

Answer is D, 100%. The very same example is part of App in a day training, Canvas app module, page 28, to be very specific. It clearly says: select the Checkbox control and click on the Action tab in the ribbon, click OnCheck and set value in the formula bar to: Collect (CompareList, ThisItem). Set the OnUncheck value to Remove(CompareList, ThisItem). This is required to make sure the unchecked items are removed from the collection”

baughfell

Agreed D 100% You cannot reset controls that are within a Gallery or Edit form control from outside those controls https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-reset

ZVV

But how we clear the Gallery control checkboxes after we clear Collection?

Maarten76

On the Checkboxes Default property, set a formula to check if the item is in the collection: ThisItem in CompareList (where CompareList is just the name of the collection) Now, when you do a Clear(CompareList) on the button (OnSelect), the checkboxes will be cleared.

charles879987

Exactly. Answer D do not uncheck the checkboxes. Why so many upvotes?

HJLN

"Users must be able to clear all product selections when they click the button." not asking to clear the checkboxes

HassanSarhan

Right, thank you!

AndreaDP

I agree with the logic for unchecking each element. However (this is very recurring with these low quality questions) the question asks to place a "button" to reset the entire gallery not to uncheck individual elements. I'll stay with the response D.

AndreaDP

Sorry...with response A!

WingsAreKing

Have you actually tried doing this? Create a gallery, attach it to a datasource, insert checkboxes, check some of them. Use a button outside of the gallery to Reset(Gallery1). What happens? Nothing. Because that's not how you reset individual controls in a gallery. D is the only viable option because of the above. Try it yourself.

K221133

correct

RazielLycasOption: D

I vote D for president

hismailOption: A

In Power Apps, the Reset function is used to reset a control to its default value. In this case, you want to clear all product selections in the gallery control when the user clicks a button. By passing the gallery control as a parameter to the Reset function, you can achieve this. The Reset function will reset all controls within the gallery, including the checkboxes, effectively clearing all product selections. The other options are not appropriate for this scenario: B. The Reload function does not exist in Power Apps. C. The ForAll function could be used to iterate through each item in the gallery, but it would be more complex and less efficient than using the Reset function. D. While you could use the OnCheck and OnUncheck properties to manage a collection of selected items, this would not directly affect the selections in the gallery control itself. Clearing the collection would not uncheck the checkboxes in the gallery.

wsjones

on test - 8/1/23

vunguyen97Option: A

"Users must be able to clear all product selections when they click the button." While D makes sense, A is actually the final answer to solve this one. The previous line about go to next page for purchases is also irrelevant to the real question. Be careful guys!

JalapenoJunOption: D

I tried this - and D is the answer. Tried A nothing happened

SGTESTOption: A

Reset can be used like this https://thepoweraddict.com/resetting-a-gallery-in-power-apps/

Riyad795

On Exam Sept 9th, 2022

HAZZTAOption: A

Answer A. The question is very specific - It asks you to add a button that rests that clears product selections when the button is clicked, not what what the entire process of adding and removing items should be. I think this is a clear case of answering the question, not providing a solution to the preamble.

Bili94

I think you don't need to put comments under the questions because yours answers doesn't help, rather you are misleading people!!!!!

TwelveConsultingOption: C

I would go with C, as it allows to patch information directly to the Table / Collection with the proper functions put afterwards. A does not work at all when I test it. D does not clear all values, so it does not answer the question.

anakinskwlkrOption: A

Its clearly A. This question specifically states: " Users must be able to clear all product selections when they click the button. YOU NEED TO CONFIGURE TE BUTTON" D is a bunch of steps to configure all the actions, but its not what the question is asking.

charles879987Option: A

A is correct. D is not correct. Clearing collection do not uncheck the checkbox selections. It has to be done by reset.

allesglarOption: D

I will go with D

stanley_ipkisOption: D

D for sure!

GregFredOption: D

D seems be ok, but there is a small gap - we clear collection but gallery are still not unchecked, so we need extra local variable and this variable should be in Reset control and on select button properties we should have a local var set to false, and then clear collection and ther local var se to true and finally we have a empty collection and uncelected gallery.

MiclarsenOption: A

While the answer may in fact be D, the correct answer on the test may also in fact be A. There is just no way of knowing for sure. Now I have no idea where this page gets the real exam questions from, but it stands to reason that if they can get them, then they also get the correct answers in the same process.