cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PBala
Helper II
Helper II

Get Items-Filter Query- Date field help

Hi,

Need to add 365 days to Modified date field and delete the item when it meets the below condition.

Action = Move and Delete and Modified is greater than 365.

 

Do I need to add a calculated field called DeletionDate in SP ( add 365days and run the below workflow) or the below flow will work?  I dont

 

The items need to remain in the list for a year from modified date and should be deleted only when Modified + 365 days and Action = Move and Delete.

 

Modified lt '@{addDays(utcNow(),-365,'yyyy-MM-dd')}' and Action eq 'Move&Delete'

 

 

PBala_0-1631136068535.png

 

Thanks in Advance.

 

Pbala

 

1 ACCEPTED SOLUTION

Accepted Solutions
ekarim2020
Super User
Super User

If you run the flow, you can examine the run time history.  You will see how the Filter query expression is evaluated  during execution:

ekarim2020_4-1631200246059.png

The expression will therefore select files where the Modified date is less than 2020-09-09 - in other words it gets files that are older than 2020-09-09 - 1 year or older. As far as I am aware, when using operators, the expressions need to be inside brackets:

(Modified lt '@{addDays(utcNow(),-365,'yyyy-MM-dd')}')  and (Action eq 'Move&Delete')

You can use a Select operation, as shown below, to select just the filename and the Modified date from the dataset produced by the Get Files action, then create HTML table and email that as a report:

ekarim2020_1-1631199279360.png

ekarim2020_2-1631199425449.png

 

ekarim2020_3-1631200169013.png

Hope this helps.

Ellis

View solution in original post

4 REPLIES 4
ekarim2020
Super User
Super User

The expression will need to be grouped in brackets:

(Modified lt '@{addDays(utcNow(),-365,'yyyy-MM-dd')}')  and (Action eq 'Move&Delete')

Ellis

Hi Ellis,

 

The expression works for me, but I am trying to understand date the logic.  

 

Does this expression translate to below statement?

 

(Modified lt '@{addDays(utcNow(),-365,'yyyy-MM-dd')}')  and (Action eq 'Move&Delete')

For example if the modified date is 9/9/2021.  The flows needs to add 365 days to the date ( 9/9/2022) and on (9/10/2022) , if action condition is also true, it needs to delete the item.

 

In the past (SP designer), I have created a calculated date column and compared against it, trying to understand flow expressions.

 

Thanks much,

 

Pbala

 

 

ekarim2020
Super User
Super User

If you run the flow, you can examine the run time history.  You will see how the Filter query expression is evaluated  during execution:

ekarim2020_4-1631200246059.png

The expression will therefore select files where the Modified date is less than 2020-09-09 - in other words it gets files that are older than 2020-09-09 - 1 year or older. As far as I am aware, when using operators, the expressions need to be inside brackets:

(Modified lt '@{addDays(utcNow(),-365,'yyyy-MM-dd')}')  and (Action eq 'Move&Delete')

You can use a Select operation, as shown below, to select just the filename and the Modified date from the dataset produced by the Get Files action, then create HTML table and email that as a report:

ekarim2020_1-1631199279360.png

ekarim2020_2-1631199425449.png

 

ekarim2020_3-1631200169013.png

Hope this helps.

Ellis

PBala
Helper II
Helper II

This makes sense. Thank you.

Helpful resources

Announcements
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.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (1,775)