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 Patch iterates...
Power Apps
Answered

For All Patch iterates only the last item

(0) ShareShare
ReportReport
Posted on by 159

I use this to collect all the items entered by the user :

IzabEwa_0-1631109038295.png

and then this to send this to the data source : 

IzabEwa_1-1631109092302.png

But if lets say user entered 8 items , and the last one is tomato, my datasource receives tomato item 8 times.

what am i doing wrong ?

Categories:
I have the same question (0)
  • BCLS776 Profile Picture
    8,994 Moderator on at

    The issue is your ForAll statement is referring to the current values stored in the controls, not to the values stored in the LineItems collection. Instead, try this:

    ForAll(LineItems As aItem,
     Patch(PowerSalesLines, Defaults(PowerSalesLines),
     {
     Item_Description: aItem.ItemDescription,
     Quantity: Value(aItem.ItemQuantity),
     Date_Of_Usage: aItem.ItemDate,
     PowerAppsKey: varkey.PowerAppsKey
     }
     )
    )
  • IzabEwa Profile Picture
    159 on at

    I get this error : 

    IzabEwa_0-1631167384374.png

     

  • PriyankaGeethik Profile Picture
    3,320 Super User 2024 Season 1 on at

    Hi @IzabEwa ,

     

    Could you please provide the code you added in your code ? 

  • IzabEwa Profile Picture
    159 on at
    ForAll(LineItems As aItem,
     Patch(PowerSalesLines, Defaults(PowerSalesLines),
     {
     Item_Description: aItem.ItemDescription,
     Quantity: Value(aItem.ItemQuantity),
     Date_Of_Usage: aItem.ItemDate,
     PowerAppsKey:varKey.PowerAppsKey
     }
     )
    )
  • PriyankaGeethik Profile Picture
    3,320 Super User 2024 Season 1 on at

    Hi @IzabEwa ,

     

    Try out below code if it helps. 

     

    ForAll(
    LineItems As aItem,
     Patch(PowerSalesLines, Defaults(PowerSalesLines),
     {
     Item_Description: aItem.Item_Description,
     Quantity: aItem.Quantity,
     Date_Of_Usage: aItem.Date_Of_Usage,
     PowerAppsKey: varkey.PowerAppsKey
     }
     )
    )

     

     

    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.

  • IzabEwa Profile Picture
    159 on at

    IzabEwa_0-1631168463040.png

    It didnt 

     

    IzabEwa_1-1631168493328.png

     

  • PriyankaGeethik Profile Picture
    3,320 Super User 2024 Season 1 on at

    Hi @IzabEwa ,

     

    Can you please show the column name of collection 

    LineItems 
  • IzabEwa Profile Picture
    159 on at

    IzabEwa_0-1631169075199.png

     

  • PriyankaGeethik Profile Picture
    3,320 Super User 2024 Season 1 on at

    Hi @IzabEwa ,

     

    Please try below and let me know the error message if it fails.

     

    ForAll(LineItems As aItem,
     Patch(PowerSalesLines, Defaults(PowerSalesLines),
     {
     Item_Description: aItem.ItemDescription,
     Quantity: aItem.ItemQuantity,
     Date_Of_Usage: aItem.ItemDate,
     PowerAppsKey: varkey.PowerAppsKey
     }
     )
    );

     

     

    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.

  • IzabEwa Profile Picture
    159 on at

    Hi it kind of worked but now the data source is not receiving the data ie. it registers the records but they are empty 

    IzabEwa_1-1631171327897.png

     

     

    IzabEwa_0-1631171280238.png

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard