web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Collect custom text in...
Power Apps
Answered

Collect custom text input fields from a gallery for all SP list items

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi everyone,

I have spent the last 3 hours trying to figure these 2 hurdles out , hope someone can help me out.

 

I'm developing a requisition business process app, using a gallery to load a products catalog from a sharepoint list. I have added a textinput field for users to input the quantity needed, with the ability to add and remove within each list item.

 

However, I have a use case where a user wants to enter the quantity needed for the items, and add them all at once, instead of adding each item one at a time.

 

1- what code should I be using to collect all quantities at once?

2- how do I disable users from adding a product unless a quantity box has been filled?

3- For some reason, I'm unable to reset the quantity field when clicking on reset all, is there something wrong with my code?

For reference, please see codes and gif below.

 

SearchBox

OnChange = Set(searchQuery,SearchBox_1.Text)

 

GalleryDryItem

Items = Filter(Search(DryItems,searchQuery,"Product"),CLI.Value="Dryfood Items")

 

Add Button

OnSelect = If(IsBlank(LookUp(FINALorderlist,ID=ThisItem.ID,ID)),Collect(FINALorderlist,{ID:GalleryDryItem.Selected.ID, ProductName:GalleryDryItem.Selected.ProductName, Quantity:GalleryDryItem.Selected.QuantityBoxDryitems.Text, UOM:ThisItem.UoM}))

Visible = !IsBlank(LookUp(FINALorderlist,ID=ThisItem.ID,ID))

 

DisplayMode (Error, this isn't working)

DisplayMode = If(IsBlank(ThisItem.QuantityBoxDryitems.Text),DisplayMode.Disabled,DisplayMode.Edit)

 

Remove Button

OnSelect = RemoveIf(FINALorderlist,ID=ThisItem.ID);Reset(QuantityBoxDryitems)

Visible = !IsBlank(LookUp(FINALorderlist,ID=ThisItem.ID,ID))

 

 

powerapps.gif

 

 

I would be very grateful for the help. Thanks.

 

 

 

<<<Edit>>>

Solution for point 3 can be found here, thanks go to @RandyHayes for that.

https://powerusers.microsoft.com/t5/Building-Power-Apps/Filter-and-collect-SPList-with-a-custom-textinput-number/m-p/698013/highlight/false#M223391  

 

Categories:
  • Verified answer
    v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    1)collect all quantities at once:
    set the add all button's OnSelect:

    ForAll(
     RenameColumns(GalleryDryItem,"ID","ID1"),
     Patch(FINALorderlist,LookUp(FINALorderlist,ID=ID1),
     {Quantity:QuantityBoxDryitems.Text}
     )
     )

    2)disable users from adding a product unless a quantity box has been filled

    set the add button's DisplayMode:

     If(IsBlank(ThisItem.Quantity),DisplayMode.Disabled,DisplayMode.Edit)

    //justify based on field, not textinput

    3)reset all:

    Do you want to reset all the items' Quantity field?
    If so, please set the reset all button's OnSelect:

    ForAll(
     RenameColumns(GalleryDryItem,"ID","ID1"),
     Patch(FINALorderlist,LookUp(FINALorderlist,ID=ID1),
     {Quantity:Blank()}
     )
     )

     

     

     

    Best regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @v-yutliu-msft  thanks for your reply.

     

    I'm sorry, I must first point out that this screen of the App is only capturing data into a collection, and not patching it into SP.

     

    GalleryDryItem= SPlist
    FINALorderlist = Collection
    Orderlist = SPlist

     

    1)collect all quantities at once into a collection "FINALorderlist", and only where QuantityBoxDryItems has a value. Right now, the only way users can add quantity into the collection is by clicking Add for each line item in the gallery.


    the business use needed is a user entering all needed quantities into "QuantityBoxDryItems", and clicking a button to add them only into the "FINALorderlist" collection.


    currently, when i click add all, it collects all items, even the ones where "QuantityBoxDryItems" is empty

     

    2)disable users from adding a product unless a quantity box has been filled
    set the add button's

     

    DisplayMode:
    If(IsBlank(ThisItem.Quantity),DisplayMode.Disabled,DisplayMode.Edit)

     

    Thanks, this worked perfectly 🙂

     

    3)reset all
    For here, we're just looking to clear the Quantity textinput i.e. QuantityBoxDryItems Textinput within the gallery, and not SPlist. Upon clicking reset, the FINALorderlist collections gets cleared, but not the QuantityBoxDryItems

     

     

    collectall.gif

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks for the help @v-yutliu-msft  , for the last bit to Add all, @RandyHayes helped me on it.

     

    Posting the solution here in case someone stumbles on this one day.

     

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Filter-and-collect-SPList-with-a-custom-textinput-number/m-p/698013/highlight/false#M223391  

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard