Hi guys,
I'm pretty new to powerapps and i'm trying to make a shopping card. I have a gallery selected with my products and i added a textinput and a add icon. Basically i want to be able to click the items i want and to count them. The screen underneath will explain what i am looking for.
In addition i am trying to collect all the items that are filled in. I am collecting values but its not working correctly.
Code that i have now for collecting shopped items:
ForAll(Gallery1.AllItems,Collect(ShoppingCart, {itemType:Gallery1.Selected.itemCategoryCode, itemName:Gallery1.Selected.displayName,itemQuantity:TextInput1.Text}))
I tried this code for the "on select" of the add icon to see if i could only get one of the gallery item textboxes to be ++
Gallery1.Selected.TextInput1.Text="1"
Once i figure out how to get this to work i will finetune the code with if statements.
Kind regards,
Anthony
Solved! Go to Solution.
Hi @Anonymous ,
There is no need to repeat the gallery reference - you are already collecting AllItems and .Selected will only reference one record (the one selected)
ForAll(
Gallery1.AllItems,
Collect(
ShoppingCart,
{
itemType:itemCategoryCode,
itemName:displayName,
itemQuantity:TextInput1.Text
}
)
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Hi @Anonymous ,
There is no need to repeat the gallery reference - you are already collecting AllItems and .Selected will only reference one record (the one selected)
ForAll(
Gallery1.AllItems,
Collect(
ShoppingCart,
{
itemType:itemCategoryCode,
itemName:displayName,
itemQuantity:TextInput1.Text
}
)
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Hello @WarrenBelz ,
Perfect this works. Can you help me with the first bit of code as well? So how i can ++ and eventually also -- every separate gallery item? I haven't done this yet. I have no clue how to only ++ the textbox corresponding to the item.
King regards,
Anthony
Hi @Anonymous ,
You would need a checkbox in the gallery (you can only select one item at a time) and check that. Using the name chkCount for the checkbox, your count would be
CountRows,
Filter(
Gallery1.AllItems,
chkCount.Value
)
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
184 | |
51 | |
47 | |
34 | |
32 |
User | Count |
---|---|
258 | |
88 | |
77 | |
68 | |
67 |