cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Duplicate problem recording in SQL and in an SPO list

Hello,

I create a stream that works like this:
when a creation or modification is done in the list A, I get the recordings as well as the version and the id to put them in list 2 then I insert the recording in SQL.

I would like registration above 25 hours to be removed from list A (I have implemented the formula but it does not work)

The problem is that as soon as there is a new element or a modification, I insert the same record several times in list B and in SQL.


Do you have any idea of ​​how to solve this problem?

 

 

 

the condition to erase it beyond the 25th hour is:

greater(utcNow('yyyyMMdd'), formatDateTime(addHours(item()?['Created'],-25),'yyyyMMdd'))
 
I will put the overdrive phase in the last position
1 ACCEPTED SOLUTION

Accepted Solutions
v-alzhan-msft
Community Support
Community Support

Hi @Anonymous ,

 

Could you please explain your flow in English or share the screenshot of the flow in English?

Please take a try to create a flow as screenshot below:

1.png

The expression in the First column of the Condition as below:

addHours(items('Apply_to_each')?['Created'],25)

The expression in the second column of the Condition as below:

utcNow()

 

 

Best regards,

Alice       

 

Community Support Team _ Alice Zhang
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

5 REPLIES 5
v-alzhan-msft
Community Support
Community Support

Hi @Anonymous ,

 

Could you please explain your flow in English or share the screenshot of the flow in English?

Please take a try to create a flow as screenshot below:

1.png

The expression in the First column of the Condition as below:

addHours(items('Apply_to_each')?['Created'],25)

The expression in the second column of the Condition as below:

utcNow()

 

 

Best regards,

Alice       

 

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

Anonymous
Not applicable

hi @v-alzhan-msft 

 

unfortunately I can not put in English, when I want to edit in the menu - Language and Time Zone - I have a load without displaying the languages.

 

I describe you my flow:

1
when an item was created or modified in my list
List A

2
I send a Http request to sharepoint
to retrieve the version of the item

3
I initialize a variable
which recovers the value of the hhtp request

4
get the elements
from list A

5
when an item has been created or modified in list A
I create the items in the list B (I take the version and the id of the list A) and in a base sql (I take again the version and the id of list A)

6
when an item is created after the 25th hour in list A, I delete the items.

 

 

I set up your code, when an item is created after 25 hours it is created in the list 2 and created in the SQL database, and it works.

 

However, he copies me every time all the items.
ex:


list A


title | ID
Hello | 2
World | 3
Ninja | 4

 

List B
title | ID
Hello | 2
Hello | 2
World | 3
Hello | 2
World | 3
Ninja | 4

 

SQL
title | ID
Hello | 2
Hello | 2
World | 3
Hello | 2
World | 3
Ninja | 4

 

Is it possible to put a condition that analyzes if the item already exists and if it does not create it?

 

 

Hi @Anonymous ,

 

Please refer to screenshot below to create the flow:

1.png

Expression in the Condition 2 as below:

length(body('Get_items_2')?['value'])

 

Best regards,

Alice       

 

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

Anonymous
Not applicable

hi @v-alzhan-msft ,

 

Thanks for the interest and your help for this flow,

 


The problem is that I can not determine the query filter because I do not have a title column in my list A and my list B.

An Item can have multiple versions and a single ID.

 

What I want is to copy the items of the list A in the list B as soon as there is a new entry in the list A without having the duplicates each time.

 

I noticed that if there is a new entry in the A list and an old item's idication, the new item takes the version of the modified item.

 

Thank you for your help, I translated and made screens of my flow with my explanations.

 

 

Anonymous
Not applicable

thks

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (2,499)