Hi all,
i have a shop with 4 categories (cat1, cat2, cat3, cat4)
I want the users only allow to order 1 item of cat1 but as many as they want from cat2, cat3, cat4
I have this on my shopping tray icon:
DisplayMode: If(LookUp(basket,itemcat=Gallery4.Selected.Category,itemcat)="cat1"),Disabled,DisplayMode.Edit)
BUT, when I switch to another category in my shop, put an item in my collection("basket") and switch back to cat1, I am able to buy another item of cat1.
How can I fix that?
Solved! Go to Solution.
Yeah, that makes sense - and yes we absolutely can change it
If(
Gallery4.Selected.Category="cat1"
&&
CountRows(Filter(basket,itemcat="cat1")) > 0,
Disabled,DisplayMode.Edit
)
So if there is already on in the basket (countrows) and the current selected one is cat1, then disable, otherwise enable it
@iAm_ManCat |
Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you! |
Thanks! |
Hi!
When you change the category, your selected item in that gallery is going to change, which then makes your formula allow it as its looking at that selected item from the gallery.
You could try counting the number of rows in your basket containing cat1 and if that is > 0 then disable it:
DisplayMode:
If(
CountRows(Filter(basket,itemcat="cat1")) > 0,Disabled,DisplayMode.Edit
)
Could you try this and let me know if you encounter any issues?
Thanks,
Sancho
@iAm_ManCat |
Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you! |
Thanks! |
Hi @iAm_ManCat
thanks for your answer.
Unfortunately I can not put anything of the other categories in the basket, because there is already one item of cat1 in the collection, and so it is disabled 😞
Any other idea?
Yeah, that makes sense - and yes we absolutely can change it
If(
Gallery4.Selected.Category="cat1"
&&
CountRows(Filter(basket,itemcat="cat1")) > 0,
Disabled,DisplayMode.Edit
)
So if there is already on in the basket (countrows) and the current selected one is cat1, then disable, otherwise enable it
@iAm_ManCat |
Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you! |
Thanks! |
Thanks a lot, that did the trick!
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
199 | |
69 | |
49 | |
48 | |
20 |
User | Count |
---|---|
263 | |
123 | |
85 | |
79 | |
70 |