I have a blank gallery to which I dynamically add rows however many I need and then add data to those rows. On save I create a collection from that data and then I patch it back to a sharepoint list. All works well.
However I now need the functionality to check for duplicates in one of the columns (it's text input, number type) before I patch it through to the sharepoint list. notify the user and give them a chance to update it.. (notify function would be absolutely fine for this)
I have read numerous duplicate questions, watch a ton of videos but can't quite get the scenario I need.
So somewhere between Collect(mycollection..... and Patch (mycollection I need an If duplicate then notify if not then patch !
Any ideas gratefully accepted
TIA
Solved! Go to Solution.
@vffdd Check this out,
ClearCollect(mySPCollection, ["1","2","2","3","4","4","5"]);
If(CountIf(AddColumns(GroupBy(mySPCollection,"Value", "myGroup"), "myCount", CountRows(myGroup)), myCount>1)>0,
Notify("Duplicates Found"),
Patch(.......); Navigate(.....))
In this case Patch and Navigate will be executed ONLY if there are no duplicates!
Please remember to give a 👍 and accept my solution as it will help others in the future.
@vffdd Follow this example and replace mySPCollection with your collection name and Value with the name of your column.
ClearCollect(mySPCollection, ["1","2","2","3","4","4","5"]);
If(CountIf(AddColumns(GroupBy(mySPCollection,"Value", "myGroup"), "myCount", CountRows(myGroup)), myCount>1)>0, Notify("Duplicates Found"))
Please remember to give a 👍 and accept my solution as it will help others in the future.
brilliant thanks @CNT I'm almost there.. that worked but showed up another issue I have by making it work 🙂 The next command after the collection has been patched is to navigate to another screen and it's just another command separated by ; from the rest. However IF there is a duplicate and patch doesn't happen I don't want to navigate? because I want them to fix it.. I only want to navigate if the patch has taken place.. so how do I join the navigate to the end of the patch as opposed to it being a separate command? I know if it was a form I could use an on success but don't think there anything similar in patch?
@vffdd Check this out,
ClearCollect(mySPCollection, ["1","2","2","3","4","4","5"]);
If(CountIf(AddColumns(GroupBy(mySPCollection,"Value", "myGroup"), "myCount", CountRows(myGroup)), myCount>1)>0,
Notify("Duplicates Found"),
Patch(.......); Navigate(.....))
In this case Patch and Navigate will be executed ONLY if there are no duplicates!
Please remember to give a 👍 and accept my solution as it will help others in the future.
Fantastic, thanks so much amazing what moving a bracket can do !! 🙂
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.
User | Count |
---|---|
195 | |
96 | |
56 | |
51 | |
41 |
User | Count |
---|---|
267 | |
156 | |
83 | |
81 | |
56 |