cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ebraga
Helper II
Helper II

Text Input in Gallery Problem

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: 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@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. 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

7 REPLIES 7
RandyHayes
Super User III
Super User III

@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.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

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
Super User III
Super User III

@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. 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

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
Super User III
Super User III

@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.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

ebraga_0-1614965967313.png

getting the same thing from the red squiggly lines

RandyHayes
Super User III
Super User III

@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. 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (56,023)