cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kitz
Helper I
Helper I

Duplicate record creating in datasource

Hello Community,

Is there any way to avoid creating duplicates in the datasource (sql server)? I'm trying to insert records in datasource but it's creating same record from the collection into the datasource? Do I need to use Update() function?

Any help would be really appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Kitz ,

I've notieced that you've asked a similar question and I've answered you.

Please refer this:

https://powerusers.microsoft.com/t5/Building-PowerApps-Formerly/ForAll-Patching-records-Item-created...

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yutliu-msft
Community Support
Community Support

Hi @Kitz ,

Could you show me your formula about updating record?

Here are some functions about updating record:

1)Patch

It can be used to create a new record and edit an existing record ( supporting modify part of fields and save other fields).

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-patch

2)Collect

It can be used to create a/several new record.

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-clear-collect-clearc...

3)Update

It can be used to replace an existing record (will not save the original record).

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-update-updateif

4)UpdateIf

It can be used to update an/several esisting record( supporting modify part of fields and save other fields).

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-update-updateif

 

If you want to avoid duplicate value, you could also check firstly before updating.

For example:

If(IsEmpty(Filter(tablename,fieldname="..."),Patch(....)) 
//if the value does not exist in the table, then patch

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for the info @v-yutliu-msft 

I tried but had no luck. My issue is kind of weird. I have a collection which contains a column ItemID with other columns. I do have another collection with ItemName, ItemDesc as columns. I need to patch records to a datasource, which has columns ItemID, ItemName and ItemDesc. How can I patch a one datasource from two collections? Any help?

 

Hi @Kitz ,

I've notieced that you've asked a similar question and I've answered you.

Please refer this:

https://powerusers.microsoft.com/t5/Building-PowerApps-Formerly/ForAll-Patching-records-Item-created...

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,711)