Announcements
I use this to collect all the items entered by the user :
and then this to send this to the data source :
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 ?
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 } ) )
I get this error :
Hi @IzabEwa ,
Could you please provide the code you added in your code ?
ForAll(LineItems As aItem, Patch(PowerSalesLines, Defaults(PowerSalesLines), { Item_Description: aItem.ItemDescription, Quantity: Value(aItem.ItemQuantity), Date_Of_Usage: aItem.ItemDate, PowerAppsKey:varKey.PowerAppsKey } ) )
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.
It didnt
Can you please show the column name of collection
LineItems
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 } ) );
Hi it kind of worked but now the data source is not receiving the data ie. it registers the records but they are empty
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.
Congratulations to our 2026 Super Users!
Congratulations to our 2025 community superstars!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
11manish 551
WarrenBelz 430 Most Valuable Professional
Valantis 298