You create a canvas app screen.
Then you add a TextInput control (named TextInputFld) and a Button (named ButtonAdd)
For the ButtonAdd, you set the button's OnSelect to the following formula: Collect(Equipment,{Product: TextInputFld.Text}) After that, you run your application and type "Generators," and push a ButtonAdd.
You add another two entries: "Pumps" and "Tanks" by pressing ButtonAdd after each entry.
You stop the run mode and modify the button's OnSelect with the following formula: ClearCollect(Equipment,{Product: TextInputFld.Text}) Then you run your app once more, input “Centrifuges,” and enter the ButtonAdd.
What products will you see in your collection?
Click on the arrows to vote for the correct answer
A. B. C. D. E. F.Correct Answer: D
Power Apps is using variables for two types of scope: App and Screen.
App variable type includes Global variables and Collections.
A Context variable belongs to a Screen scope type.
Collections are memory tables that can be called from any part of the app.
You can store a collection to the local device storage, such as mobile devices, using SaveData and retrieve data by LoadData functions.
When you run your canvas app the first time and enter the three items, the canvas app creates a new Equipment collection with three entries.
After you run the ClearCollect(Equipment,{Product: TextInputFld.Text}), the command deletes all the records from the Equipment table and adds a new record - “Centrifuges.”
All other options are incorrect.
For more information about Power Apps collections, please visit the below URLs:
The initial formula set as the OnSelect property of ButtonAdd is as follows:
scssCollect(Equipment,{Product: TextInputFld.Text})
This formula collects data and stores it in a collection named "Equipment." The data collected is an object with one property called "Product," which is assigned the value of the text entered in the TextInput control named "TextInputFld." Therefore, when you run the application and type "Generators," and push the ButtonAdd, the collection "Equipment" will contain the following object:
css{Product: "Generators"}
Then, you add two more entries: "Pumps" and "Tanks" by pressing ButtonAdd after each entry. So the collection "Equipment" will now contain three objects:
css{Product: "Generators"} {Product: "Pumps"} {Product: "Tanks"}
After that, you stop the run mode and modify the button's OnSelect property with the following formula:
scssClearCollect(Equipment,{Product: TextInputFld.Text})
This formula clears the "Equipment" collection and replaces it with a new object. The new object has the same property name "Product," but its value is the text entered in the TextInput control named "TextInputFld." Therefore, when you run the app once more, input "Centrifuges," and enter the ButtonAdd, the collection "Equipment" will contain only one object:
css{Product: "Centrifuges"}
So, the correct answer is (D) Centrifuges.