Hi I am trying to display data in a textinput control based on which checkbox is selected in a gallery. But it seems that the statement: 'Gallery.Selected.CollectionField1' is giving unintended results. For example in the gallery if I had 2 items A & B. If I check A first, then I check B second. Then I uncheck B, and hit the modify button to go back to the previous screen, it should show item 'A' data. But it shows item 'B', or whatever was checked OR unchecked last. I tried the Refresh(Gallery1.Selected) or Refresh(Gallery1.AllItems) in the Modify button 'OnSelect' property but that didnt work. Would appreciate the help. Thanks.
Solved! Go to Solution.
Hi @yashag2255 ,
Thanks for reply. I tried the code but that did not work. It still see's the last thing I do to the checkbox (whether it's checking it or unchecking it) as the one that is selected.
Also I put 'ResetCheckbox'; in the Reset property of the checkbox, but it is giving me an error because I already have a contextvariable in there. For some reason it does not like it and giving error 'Expected operator. We expect an operator such as +, *, or & at this point in the formula. Operators join two operands together. This error occurs if you put two functions (operands) together with no operator between them -- for example, Len("mytext")Len("mytext").
I have ContextvariableA; ResetCheckbox; in there. I commented out ContextvariableA to try the method you gave me, but as I said up top, it still doesn't work.
ok I guess thats why if I commented out contextvariableA, the error goes away. But as I said earlier, Set(ResetCheckbox,true);Set(ResetCheckbox,false); did not work. It is still seeing the last thing I did to the checkbox as the Gallery.selected.collectionfield1. Any other suggestions?
HI @yashag2255 ,
I noticed that Gallery.Selected does not look at what record is checked in the gallery, rather it looks at what was selected by the mouse click. See picture below. I last unchecked checkbox A, so it leaves a box around the checkbox. So it sees that as the Gallery.Selected. Anyway where it looks at the checked box instead of the last thing the mouse touched?
Hi @yashag2255 ,
Yes that worked! LookUp(Gallery3.AllItems, Checkbox3.Value = true).Title is a powerful expression. I'll be sure to use this more in the future. Tried all day trying to fixed this. Thank you so much for your help.
Check out new user group experience and if you are a leader please create your group
Did you know that you can visit the Power Query Forum in Power BI and now Power Apps
Participate in the Power Virtual Agents Community Challenge
Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.