the following statement works great. It loads data into a Parts table from a database object. Those items from the database are marked as "Saved", and then loads data from a local table, and those were previously noted as "Changed".
Here is the code:
ClearCollect(Parts,
(AddColumns('[dbo].[vwParts]',"Status","Saved"),
LoadData(Parts,"PartsLocal",true));
This works, but the issue is that there are in some cases duplicate rows: Saved and Changed. There could be more "Changed" rows than saved rows, and those are ok. But if there is a Saved Row and a Changed Row with the Same RowId, then those two rows need to be merged into only one row, with the values from the "Changed" superseding those in the "Saved" row.
Not certain how to modify the above code to accomplish this.
Help is much appreciated.
Thank you
Hi @vsslasd
You could theoretically filter the list using the First or Last Function's if the data is in a logical format. I.E. if the Duplicates always go Saved then Changed in the order of the list (You could also maybe sort the List By ID and then Status to give you the correct format for this) After this using Last() to pickup the Second Duplicate will give you a clean list.
If not its a bit more complicated. You could maybe do a clean up job first, using distinct() on the PartsLocal collection, to get a list of ID's and removeif() to clean these out of the Parts collection before you Load the data.
A bit complicated but there isn't much duplicate correction in Powerapps just now.
Hope this helps,
Nicky
User | Count |
---|---|
142 | |
137 | |
78 | |
77 | |
73 |
User | Count |
---|---|
228 | |
177 | |
68 | |
68 | |
58 |