cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Prodigy
Post Prodigy

Delete Rows older than 7 day`s

I try to create a flow to remove lines where the date in the column received mail is older than 7 days.
However, things are not going well.
Flow runs very long and no lines are deleted.

 

Flow4.png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User III
Dual Super User III

Re: Delete Rows older than 7 day`s

Hi @frixel , The problem is you are doing another apply to each in the yes tab of the condition loop. 

 

See the screenshot below:

yey.png

You do not have to add another apply to each loop. it should be just delete the row option. (as the apply to each is already there in the parent action)

View solution in original post

67 REPLIES 67
Highlighted
Dual Super User III
Dual Super User III

Re: Delete Rows older than 7 day`s

Hi @frixel 

 

Can you post the screenshot of the errors that you are getting. 

 

For comparing with the date field in flow, I would suggest you to convert the date from excel using the formatedatetime expression and make the comparisions between the similar format of dates,

 

Hope This Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Highlighted
Post Prodigy
Post Prodigy

Re: Delete Rows older than 7 day`s

Hi @yashag2255 

 

As you say i have the formatdatetime changed to:

convertTimeZone(utcnow(),'UTC',-7,'W. Europe Standard Time','dd/MM/yyyy')
is that right?
 
see also the error i have.
 
Flow2.png
 
Flow1.png
Highlighted
Dual Super User III
Dual Super User III

Re: Delete Rows older than 7 day`s

@frixel 

 

As you can see the error snippet, there was an error in the expression for the date. Kindly use the expression below and test it out: 

 

convertFromUtc(addDays(utcNow(),-7),'W. Europe Standard Time','dd/MM/yyyy')

Hope this Helps!

Highlighted
Post Prodigy
Post Prodigy

Re: Delete Rows older than 7 day`s

Hi @yashag2255 

That is better but....

When the condition is "is less than" it deletes only the row from exactly 7 days ago (29-05-2019)

When the condition is "is equal to " it deletes nothing

When the condition is "is greater than" it deletes only the row from exactly 7 days ago (29-05-2019)

 

I want to delete al the rows older than 7 day`s, what must i than fill in?

 

Highlighted
Dual Super User III
Dual Super User III

Re: Delete Rows older than 7 day`s

@frixel 

 

I replicated a similar usecase to delete rows that have a task id 2 and this worked perfectly in my case. Please have a look at the screenshot below and confirm you have a similar configuration for deleting the rows mapped to the date 

exce.png

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Highlighted
Post Prodigy
Post Prodigy

Re: Delete Rows older than 7 day`s

Hi @yashag2255 

 

I don`t understand it. I think it is as you suggested an the flows gives no errors.

But it deletes no rows...

► Update ► but only the one that is a date from 29-05-2019 (that is exactly 7 days)

 

Flow1.png

 

Flow3.png

 

Flow2.png

 

Highlighted
Dual Super User III
Dual Super User III

Re: Delete Rows older than 7 day`s

Hey @frixel 

 

I can see that the flow is running but looks like the condition is not getting satisfied. 

 

Can you please do these things and share the output with me: 

 

In the apply to each control in the condition can you replace the Received Mail with an expression: 

formatDateTime(items('Apply_to_each')?['Received Mail'], 'dd-MM-yyyy') run the flow and check the output.
 
If this does not work, 

 

I want to see what you are getting in the Received Mail column in the flow. Can you initialise a variable and get that output and post the screenshot here?

 

Thanks, 

Highlighted
Post Prodigy
Post Prodigy

Re: Delete Rows older than 7 day`s

Hi @yashag2255 

 

Flow5.png

What do you mean with:

 

If this does not work, 
I want to see what you are getting in the Received Mail column in the flow. Can you initialise a variable and.........

 

Highlighted
Dual Super User III
Dual Super User III

Re: Delete Rows older than 7 day`s

@frixel 

 

There is a mismatch in the date formats that we are trying to compare. Can you please initialise an array variable outside the apply to each control and inside the apply to each, before the condition create an action of append to array variable and select the variable that you initialised and put the Received Mail column in the value and run the flow and share the screenshot of the output of the append to array variable. 

 

Thanks. 

Highlighted
Post Prodigy
Post Prodigy

Re: Delete Rows older than 7 day`s

Hi @yashag2255 

 

Do you mean like this?

The flows run but the are no deleted rows.

I'm not a hard flow maker, so I'm just trying

Flow7.png

 

Flow6.png

Highlighted
Dual Super User III
Dual Super User III

Re: Delete Rows older than 7 day`s

Can you post a screenshot of the data that is in the filter array? 

Highlighted
Post Prodigy
Post Prodigy

Re: Delete Rows older than 7 day`s

Flow8.png

Highlighted
Dual Super User III
Dual Super User III

Re: Delete Rows older than 7 day`s

Hi @frixel , I meant that I wanted to see the date format that is coming in the flow. So in the run that has been completed, can you expand the filter array action results and share that screenshot (barring all the sensitive information)

Highlighted
Post Prodigy
Post Prodigy

Re: Delete Rows older than 7 day`s

Hi @yashag2255 

You mean this?

Inputs from.

[
{
"@odata.etag": "",
"ItemInternalId": "777c15f5-9c6f-4657-a2fb-9cf10a07d96e",
"From": "",
"Subject": "",
"Received Mail": "",
"colom": "1"
},
{
"@odata.etag": "",
"ItemInternalId": "f3cf8f6a-f156-40f2-8888-6196e067abff",
"From": "nl",
"Subject": "RE: ",
"Received Mail": "25-05-2019",
"colom": ""
},
{
"@odata.etag": "",
"ItemInternalId": "4a82ecd9-f4ce-4441-a27b-f4a6249c249d",
"From": "nl",
"Subject": "RE: ",
"Received Mail": "25-05-2019",
"colom": ""
},
{
"@odata.etag": "",
"ItemInternalId": "b2de9467-9233-459f-82ab-33769b978282",
"From": "nl",
"Subject": "Re: es",
"Received Mail": "26-05-2019",
"colom": ""
}

-----------------------------------------------

output Body.

[
{
"@odata.etag": "",
"ItemInternalId": "77d8cce6-b29a-4fe8-9413-db3fd9e4d79a",
"From": "",
"Subject": "RE: Vs",
"Received Mail": "29-05-2019",
"colom": ""
},
{
"@odata.etag": "",
"ItemInternalId": "d1e68e52-277a-439b-a9c0-de59638960b3",
"From": ".nl",
"Subject": "RE:d 8710873994925 s",
"Received Mail": "29-05-2019",
"colom": ""
 
► The output body  are exactly the 2 rows with exactly 7 days ago (29-05-2019)  but also this rows are not deleted.
Highlighted
Dual Super User III
Dual Super User III

Re: Delete Rows older than 7 day`s

Hi @frixel 

 

The data coming in is of correct format and I tested it out in my environemnt and it works perfectly fine. You can remove the compose action and revert your flow to the state it was before. Can you run it again and check the output that way?

Highlighted
Post Prodigy
Post Prodigy

Re: Delete Rows older than 7 day`s

hi @yashag2255 

 

You mean i make the flow again as in post 1?

Highlighted
Dual Super User III
Dual Super User III

Re: Delete Rows older than 7 day`s

Also, make the following change in the original flow. 

skhks.png

In the key value, remove the expression and choose the Received Mail option from the dynamic content selector. 

 

This should Work. 

Highlighted
Post Prodigy
Post Prodigy

Re: Delete Rows older than 7 day`s

Hi @yashag2255 

 

Also in this case only 2 rows deleted with the date 29-05-2019.

 

Flow10.png

 

Flow9.png

 

 

Highlighted
Dual Super User III
Dual Super User III

Re: Delete Rows older than 7 day`s

Hey!

Can you confirm the number of rows in the table? (21?)

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (7,162)