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 / For all and Patch form...
Power Apps
Answered

For all and Patch formulas

(0) ShareShare
ReportReport
Posted on by 22

I'm trying to make this app send inventory to a share point. I enter quantities down the list and then enter the store number and then hit restock. I want to enter multiple quantities and hit the restock button 1 time and have them send to the share point organized all at once under that store number. It works but doesn't filter it in the way I need it too. It sends more than one now but not in the correct rows and columns. They should all be under store 9 (what I entered) and should have 2 products or however many I enter under it with the correct quantity and store. Also, if i just click on a quantity box and don't enter nothing and go to a different box, it still will sends that blank box. Shouldn't do that. But there is no error message now. My collection formula looks like this and is my whole gallery 

Annotation 2020-06-30 094504.png

Annotation 2020-06-30 094904.png

 

And when I enter the information and hit the restock button it goes to the share point like this. 

Annotation 2020-06-30 094720.png

 

 

My restock formula looks like this. We are getting somewhere, its going in the right direction. Thank you guys for your patience. 

Restcok form.png

 

 

Categories:
I have the same question (0)
  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @tbrew ,

    I found that you have posted this same issue in your previous reply, please check my response within the following thread:

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Struggling-with-formula/td-p/608923/page/2

     

    Please consider take a try with the following formula in your app:

    'PowerApp->Createitem'.Run(
     Title1.Text, // please do not miss .Text
     Subtitle1.Text, // please do not miss .Text
     TextInput6.Text, // please do not miss .Text
     TextInput7.Text, // please do not miss .Text
     DatePicker1.SelectedDate // please do not miss .SelectedDate
    );
    ForAll(
     Filter(ColInventory, !IsBlank(Quan)), // filter out these items whose Quan column is Blank
     Patch(
     'Inventory by apps',
     Defaults('Inventory by apps'),
     {
     Product: ColInventory[@Title],
     'Sku #''s': ColInventory[@Skuu],
     'Store Number': ColInventory[@StoreNum],
     Quantity: ColInventory[@Quan]
     }
     )
    )

    or

    'PowerApp->Createitem'.Run(
     Title1.Text, // please do not miss .Text
     Subtitle1.Text, // please do not miss .Text
     TextInput6.Text, // please do not miss .Text
     TextInput7.Text, // please do not miss .Text
     DatePicker1.SelectedDate // please do not miss .SelectedDate
    );
    ForAll(
     ColInventory,
     If(
     !IsBlank(ColInventory[@Quan]),
     Patch(
     'Inventory by apps',
     Defaults('Inventory by apps'),
     {
     Product: ColInventory[@Title],
     'Sku #''s': ColInventory[@Skuu],
     'Store Number': ColInventory[@StoreNum],
     Quantity: ColInventory[@Quan]
     }
     )
     )
    )

    Please take a try with above solution, then check if the issue is solved.

     

    If the solution I provided in your previous reply could fix your original issue, please consider go ahead to click "Accept as Solution" to identify my solution as helpful in your previous reply, and then we could help you in this thread.

     

    Best regards,

  • tbrew Profile Picture
    22 on at

    @v-xida-msft Now its showing up in  the share point like this instead of with the products I chose. One of these is it but the other doesn't send through and it sends the same product twice like this. Say I ordered cat and dog food through the pp and sent them to the share point. It only sends dog food when I need both.

    Same products.png

     

     

    My formulas look correct

    form2.png

     

     

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @tbrew ,

    Firstly, please make sure how many records existed in your ColInventory collection when you executing your ForAll formula.

     

    According to the formula that you mentioned, each time, you execute your ForAll formula, the ColInventory collection should only contains one record at most, because, you use the ClearCollect function rather than the Collect function.

     

    So I guess this issue may be related to the 'PowerApp->Createitem'.Run() formula. According to this formula, I think you have added a "Create item" action in your flow to add new entry into your 'Inventory by apps' List with values passed from your canvas app.

     

    Please remove the  'PowerApp->Createitem'.Run() formula from your "Submit" button, just execute the following formula:

     

    ClearCollect(
     ColInventory, 
     {
     Title: Title1.Text,
     Skuu: Subtitle1.Text,
     StoreNum: TextInput6.Text,
     Quan: TextInput7.Text
     }
    );
    ForAll(
     ColInventory,
     If(
     !IsBlank(ColInventory[@Quan]),
     Patch(
     'Inventory by apps',
     Defaults('Inventory by apps'),
     {
     Product: ColInventory[@Title],
     'Sku #''s': ColInventory[@Skuu],
     'Store Number': ColInventory[@StoreNum],
     Quantity: ColInventory[@Quan]
     }
     )
     )
    )

     

     

    Please take a try with above solution, then check if the issue is solved.  If the solution I provided in your previous thread could solve your original issue, please consider go ahead to click "Accept as Solution" to identify my reply as solution and close your previous thread. Your previous threads as below, please consider close them:

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Struggling-with-formula/td-p/608923/page/2

    https://powerusers.microsoft.com/t5/Building-Power-Apps/For-all-and-Patch-formulas/td-p/611618

     

    If you still have some issue with your scenario, please consider open new thread in our community, describe your issue there, then we could help you there.

     

    Best regards,

  • tbrew Profile Picture
    22 on at

    @v-xida-msft now all it does is create a single item and not all the ones I wanna select. I have the exact formula down that you have created.

  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @tbrew ,

    I think this issue is related to ClearCollect formula, just as I mentioned before, it could only contains single one record. Please try the following formula (just execute the following formula):

    ForAll(
     Gallery1.AllItems, // Gallery1 represents the Gallery in your app, please replace it with actual Gallery control name
     If(
     !IsBlank(TextInput1.Text),
     Patch(
     'Inventory by apps',
     Defaults('Inventory by apps'),
     {
     Product: Title1.Text,
     'Sku #''s': Subtitle1.Text,
     'Store Number': Value(TextInput6.Text),
     Quantity: Value(TextInput1.Text)
     }
     )
     )
    )

    or

    ForAll(
     Filter(Gallery1.AllItems, !IsBlank(TextInput1.Text)),
     Patch(
     'Inventory by apps',
     Defaults('Inventory by apps'),
     {
     Product: Title1.Text,
     'Sku #''s': Subtitle1.Text,
     'Store Number': Value(TextInput6.Text),
     Quantity: Value(TextInput1.Text)
     }
     )
    )

    Note: DO NOT execute the  'PowerApp->Createitem'.Run() formula and ClearCollect formula.

     

    Best regards,

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 150 Super User 2026 Season 2

Last 30 days Overall leaderboard