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

Question

Question

Searching for Documents Dated This Year

asked on August 7, 2017

I have a customized field "Document Date". I would like to generate a report (in Workflow) but I can't seem to get the search correct.

{[]:[Document #]~="'E-*'"} & {[]:[Document Date]=THISYEAR} & {LF:Name="*", Type="D"}

Can I run this where it will generate search results for "this year's" documents? I don't want to have to go in every new year and update it if it's hard coded.

0 0

Answer

SELECTED ANSWER
replied on August 8, 2017 Show version history

Can you just put a Date Token Calculator activity at the beginning of your workflow?  Use the current date and format it to pull just the year.  Then use the token in your query in place of "THISYEAR".  Something like ... {[]:[Document Date]="*%(CurrentYearToken)" ... where the token is what you created earlier in the workflow.

 

CurrentYear.jpg
CurrentYear.jpg (130.89 KB)
2 0
replied on August 8, 2017

In addition to Jennifer's solution, you might try a date token calculator like this.

1 0
replied on August 9, 2017 Show version history

With both tokens:

({[]:[Document #]~="'E-*'"} & {[]:[Document Date]="*%(CurrentYearToken)"} & {LF:Name="*", Type="D"}) & {LF:LOOKIN="\01 Business Record"}

({[]:[Document #]~="'E-*'"} & {[]:[Document Date]>="%(StartDate)"} & {LF:Name="*", Type="D"}) & {LF:LOOKIN="\01 Business Record"}

When I go to test it, it asks for the year but then I get an error:  "The search parameter is invalid. [9245]".

 

0 0
replied on August 9, 2017

Are you putting in a full date or just the 4 digit year? It should be in the format of 01/01/2017. That is the reasoning for using the date calculator.

1 0
replied on August 9, 2017

I see in the query you typed you have >= before the tokens.  Would you need that in with the current year token?  Would you not just want = for it?  Then you would be saying anything were the date ends with 2017.  The * should cover everything before 2017.

Otherwise is the Document Date field a date field or a text field?  What about setting up the query in client first where  a date field lets you put in a range.  You could make two tokens for Start Date and End Date like in John's post and use the tokens in the search.

{[]:[Date]>="%(StartDateToken", <="%(EndDateToken)"} & {LF:Name="*", Type="D"} & {LF:LOOKIN="repository name\folder path"}

 

0 0
replied on August 10, 2017 Show version history

OK, the Start Date token DID work! I was testing incorrectly. As John suggested, I was not testing properly. When asked for test input, I keyed in just the year and should have keyed in 01/01/2017. The year token will be helpful elsewhere in my logic, so thanks everyone for the input!!!

0 0

Replies

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

Sign in to reply to this post.