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 / Text Input in Gallery ...
Power Apps
Answered

Text Input in Gallery Problem

(0) ShareShare
ReportReport
Posted on by 118

Hello All,

 

I have a gallery of items where the user enters the quantity they want per line item. The check box adds the item to the collection. However, on submit the 1st quantity requested is being duplicated throughout the line items. This doesn't make sense to me since the correct numbers show up in the collection. (I hope this is making sense. ) Here are some screenshots for reference. Please help!

ebraga_0-1614959087778.png

onsubmit:orAll(colResults, Patch('Transfer Sheet & Product Availability', Defaults('Transfer Sheet & Product Availability'), {QuantityType:QuantityType,Bin:bin,QtyAvailable:QtyAvailable,Item:itemnmbr,'Lot No':lotnumbr,um:um,QtyRequested:QtyRequested.Text},Form1.Updates));ViewForm(Form1);RequestHide()

 

List showing all qty requested as "3"

List shows: 

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @ebraga 

     

    Your problem stems from the fact that you are using QtyRequested.Text in your formula.  This is most likely the name of the control in your Gallery.  Since you are not referencing that in context of the Gallery, it will only take the first value.

     

    You can cut the use of a collection in what you are doing, because your Gallery is already a collection of the values you want.  Also...don't waste the output of your ForAll it returns the table of what you want to put into your datasource.

     

    Please consider changing your Formula to the following:

    Collect('Transfer Sheet & Product Availability', 
     ForAll(yourGallery.AllItems,
     Patch(
     {QuantityType: GalleryControlForQuantityType.Text,
     Bin: GalleryControlForbin.Text,
     QtyAvailable: QtyAvailable,
     Item: GalleryControlForitemnmbr.Text,
     'Lot No': lotnumbr,
     um: um,
     QtyRequested:QtyRequested.Text
     },
     DropColumns(Form1.Updates, "ID")
     )
     )
    );
    ViewForm(Form1);
    RequestHide()

     

    Replace the values items for all of the columns in the formula to match the names of the controls in your gallery.  Also adjust for text or number where needed.

    As well, you seem to be including the updates property of your form in this...you will need to drop the ID column from that record as it will interfere with the creation of the new record.

     

    I hope this is helpful for you.

  • ebraga Profile Picture
    118 on at

    Okay so I need to reference Qty Requested in the context of the gallery. However, I don't want all gallery items to be patched, only those that have been selected which is why I was using a checkbox & a collection. Is there any way I can use on check to select gallery items and then have them patched on submit to my sharepoint list?

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @ebraga 

    Yes, if you have a checkbox in the gallery, then just add that to the formula:

    Collect('Transfer Sheet & Product Availability', 
     ForAll(Filter(yourGallery.AllItems, yourGalleryCheckbox.Value ),
     Patch(
     {QuantityType: GalleryControlForQuantityType.Text,
     Bin: GalleryControlForbin.Text,
     QtyAvailable: QtyAvailable,
     Item: GalleryControlForitemnmbr.Text,
     'Lot No': lotnumbr,
     um: um,
     QtyRequested:QtyRequested.Text
     },
     DropColumns(Form1.Updates, "ID")
     )
     )
    );
    ViewForm(Form1);
    RequestHide()

    Replace yourGalleryCheckbox with the name of your checkbox. 

  • ebraga Profile Picture
    118 on at

    Thank you for your help, I am quite a newbie when it comes to powerapps. Unfortunately I am getting four different errors: 

    ebraga_0-1614965367844.png

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @ebraga 

    These errors don't mean much.  

    Can you provide instead the formula you are now using...perhaps a screenshot of that with any red underlines it might have in it.

     

  • ebraga Profile Picture
    118 on at

    ebraga_0-1614965967313.png

    getting the same thing from the red squiggly lines

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @ebraga 

    Thanks, that helped tremendously.

     

    I see I missed something in my formula.  DropColumns only works on tables, not records...so I needed to do a little back and forth conversion to get rid of that column.

     

    Collect('Transfer Sheet & Product Availability', 
     ForAll(Filter(yourGallery.AllItems, yourGalleryCheckbox.Value ),
     Patch(
     {QuantityType: GalleryControlForQuantityType.Text,
     Bin: GalleryControlForbin.Text,
     QtyAvailable: QtyAvailable,
     Item: GalleryControlForitemnmbr.Text,
     'Lot No': lotnumbr,
     um: um,
     QtyRequested:QtyRequested.Text
     },
     First(DropColumns(Table(Form1.Updates), "ID"))
     )
     )
    );
    ViewForm(Form1);
    RequestHide()

    See where we get with that. 

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 316 Most Valuable Professional

#2
11manish Profile Picture

11manish 242

#3
Valantis Profile Picture

Valantis 198

Last 30 days Overall leaderboard