You are viewing limited content. For full access, please sign in.

Question

Question

Search Repository for Date Fields

asked on April 3, 2017

Good afternoon,

 

I'm putting together a Workflow that will search records in a Repository that have been there for the past 24 hours.

Since I'm new at doing this I thought of starting small and just look for a specific hard-coded date filed using the example in the manual by using a Search Repository Activity and setting the Search Query box to {LF:Created="2017/01/11"}.

When I click on the "Test Search Query" link it returns 4 records. My second step was to send myself the information by email; that's where I'm stuck :(

Right below the Search Repository Activity I have a For Each Entry. Inside of the For Each Entry Activity I have a Retrieve Field Value Activity, a Track Tokens Activity and an Email Activity. Not sure if I'm doing this correct, but it seems to be sending me 4 emails, so it works.

Now my question is, how can I update the static date to say that I want to check for a date of (Today minus 24 hours). 

I was reading the manual here: https://answers.laserfiche.com/files/downloader/81076?save=True but don't seem to find an example like that.

I tried using something like this '%DMY" to retrieve at least today's documents but that didn't work. Has anyone worked with something similar that can point me into the right direction?

0 0

Answer

SELECTED ANSWER
replied on April 3, 2017 Show version history

You can use the Date Token Calculator along with the global %(Date) token to create any range of dates you can then use in the Search Query.  So the search would be {LF:Created>="%(DateTokenCalculator_DateTime 1)"}  for all created in the last 2 days or remove the ">" and make it search for only the created 2 days ago.

 

2 0

Replies

replied on April 3, 2017

The search query  {LF:Created="%(Date)"} will search for today's date.

I am not sure what information you want to get from your emails but moving the email activity out of the For Each Entry loop you will get just one email, and with the fallowing Token( %(ForEachEntry_Iteration) ) you can get the total number of items found in the search. 

1 0
replied on April 3, 2017

Thanks Travis, your code worked and helped me get started on what I needed. Moving forward I tried to get documents that are older than 2 days by doing {LF:Created="%Date")-2D} and also tried {LF:Created="%Date")-2} but those didn't work; the manual doesn't show an example of this. Would you happen to know how to plug (-24hours) or (-2 days) into the search?

0 0
SELECTED ANSWER
replied on April 3, 2017 Show version history

You can use the Date Token Calculator along with the global %(Date) token to create any range of dates you can then use in the Search Query.  So the search would be {LF:Created>="%(DateTokenCalculator_DateTime 1)"}  for all created in the last 2 days or remove the ">" and make it search for only the created 2 days ago.

 

2 0
replied on April 4, 2017

Thanks Travis,

 

I'm playing around with that activity. I have 4 forms. One of it is exactly 6 days old. Another one is 5 days old and the other two older than 6 days old.

Strange, when I use your code with >= it returns the 6 day old and 5 day old. When I use = it returns the 6 day old. 

Now If I wanted any document older than 6 days I would assume that I could use <= but when I try that, it returns the 2 document older than 6 days but not the one exactly 6 days old. I tired to change the activity to 1 day to see if it would give me all that documents, but still just gives me the ones that are more than 6 days old for some reason.

 

I have the Date Token Calculator as Subtract 1 days and the code looks like {LF:Created<="%(DateTokenCalculator_1DaysAgo)"}

 

The created dates for the documents are 2/14/2017,  2/14/2017, 3/28/2017 and 3/29/2017.

 

What setting could I have missed?

0 0
replied on April 4, 2017

It's probably your missing time component. Creation dates are actually date-time, so 3/28/2017 4:12 AM is greater than 3/28/2017 (which is interpreted as 3/28/2017 12:00 AM).

0 0
replied on April 4, 2017 Show version history

Thanks, but the strange thing is that today is 4/4/2017 and the documents that are in the folder that I'm searching are

2/14/2017,  2/14/2017, 3/28/2017 and 3/29/2017.

 

So, for testing purposes I set the Date Token Calculator to Subtract 1 day from today date and then using Travis script {LF:Created<="%(DateTokenCalculator_1DaysAgo)"}

still gives me the ones from Feb. only. The ones in March are way off from today as to be affected by the time, but you never know. We had a similar issue that was fixed by adjusting the Time Zone, but in that particular case we were only off by 1 day.

I'll check that setting and report back.

0 0
replied on April 4, 2017 Show version history

Oh No! I don't know at what point that Workflow setting was updated but there is a section in the properties for "Results to Return" and the choices are First Result, First X Results (where x is any given number, and All Results.

I had this set to First 2 Results...Changed it to All Results and now all 4 are getting caught.

Thank you all for sticking with me on this. 

 

In Travis' suggestion of taking out the Email activity from the loop and just populating a report within a single email, I think that's what I would prefer; but of course that would be a different scenario. I will be sure to publish a new question relevant to Email Activity if I ran into other challenges.

 

Thanks again.

0 0
replied on April 4, 2017

Just to close this up. I was bouncing form article to article in trying to find a solution for the "Email" part and ran across someone that recommended this URL below, which really helped in wrapping it up. Just in case someone runs across this post looking to do something similar.

URL: https://www.laserfiche.com/solutionexchange/amplify-your-workflows-with-html

Thanks all.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.