Hi power-platform experts,
I'm building an application to raise demands in an organization, suppose there are 10 demands based on skill , level , availability, so If he wants a single demand he should be only able to select 2 demands of his choice out of 10 not more than that , if he wants 2 demands out of all 10 he should be able to select only 3 based on his choice. Is there a way to restrict the number of selections a person can make in gallery ?
Pls help me
Thankyou
Solved! Go to Solution.
Try putting this code in the DisplayMode property of the Button 9:
If(
LookUp(ResourceCollector, Column3 = ThisItem.Column6, true) // condition to see if this item exists in the collection already
|| // Or
CountRows(ResourceCollection) > 2, // condition to see if more than two rows are in the collection already
Displaymode.Disabled, // If true, disable the button
Displaymode.Edit // Otherwise, leave it enabled
)
This code will disable that Button9 if that record has already been selected, or if more than 2 records already exist in the collection. Does that get you closer to what you wanted?
It's a bit tough to tell from the screenshot you provided, but it is possible to control the DisplayMode of controls based on conditional logic. Keep it in Edit mode when the person has made less than 2 selections, and put the control in Disabled mode when the selections are 2 or greater.
Depending on your app logic, it may be as simple as doing a CountRows on your gallery's AllItems property to determine how many rows exist in that control and if it is more or less than 2
Hope that helps,
Bryan
Hi Bryan,
thanks for the help actually I'm new to power-apps , see I'm using a collection to store the selections made so I selected 2 profiles - ref - On select SS
So now when I click on view selected resources it will take me to another screen where it is connected with my collection list it shows me my selections , ref - View Selected & Results
Now there I can add as many resources as I want but as you said we can limit the selections so you mean we can set the display mode & add some conditions there, are you talking about the displaymode of the button ? I've also attached the formula what I'm using for Onselect & Displaymode , sorry for asking too many things pls guide me if possible ref - Onselect Button function & display mode,
I want the user to select random values so I'm not sure if count rows will work or not
Thankyou
Try putting this code in the DisplayMode property of the Button 9:
If(
LookUp(ResourceCollector, Column3 = ThisItem.Column6, true) // condition to see if this item exists in the collection already
|| // Or
CountRows(ResourceCollection) > 2, // condition to see if more than two rows are in the collection already
Displaymode.Disabled, // If true, disable the button
Displaymode.Edit // Otherwise, leave it enabled
)
This code will disable that Button9 if that record has already been selected, or if more than 2 records already exist in the collection. Does that get you closer to what you wanted?
Thanks Bryan it worked for me
User | Count |
---|---|
262 | |
110 | |
92 | |
55 | |
41 |