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

Question

Question

"String not recognized as a valid DateTime" error when looping through search results

asked on February 5, 2016

I'm putting together a simple workflow that evaluates search results by date and separates entries which were made before and after a cut-off date ("old" entries that still need something done with them versus "new" entries). The cut-off is 7 days prior to the date the workflow was run (i.e. current day's date).

I ran into an odd error, odd in that when I'm dealing with just 1 result, the date comparison works. But as soon as I have more than one, the workflow terminates with the "string not recognized as a valid DateTime" error. So whether I try to do a "For Each Entry" on 2 results or all results, the error happens. But a simple comparison with 1 result won't trigger the error.

Here is the simplified workflow I've been using to test various scenarios and try to find the error:

And here are the formatted tokens, as well as the conditional evaluations for reference:

  

 

  

 

I save the Creation Date of the current entry when entering the loop:

 

 

First conditional statement (the second is the same except, of course, the comparison is greater than or equal to the "7 days before" date):

 

 

The date tokens are all tagged as DateTime, which is where I thought the error was coming from at first because I had one or two that were tagged as 'string'.  I also tried switching between Date and DateTime, as well as playing with the formatting - in this example I included time as well, thinking perhaps that was the issue but the error remains.

Tracking the tokens produces this result:

The date formats appear to match but the error happens on the first conditional evaluation:

 

 

Again, the comparison will work with just one entry, but not more than one. And with that one entry I only had to ensure the date tokens were tagged as Date - having to format them for time or change the month/day order wasn't necessary.

I'm stymied as to why the For Each isn't working. Thanks in advance for any insight into this!

0 0

Replies

replied on February 5, 2016

before set new value token try assigning the current value to create date time token and then compare that value and see what happens in that case.

0 0
replied on February 10, 2016

Thanks for the suggestion, Junaid. I get "String was not recognized as a valid Date Time" on that activity:

 

 

 

 

If definitely seems like the "For Each Entry" activity is messing with the date comparison. For the time being I'm just going to run two separate searches (one for new documents, one for old) and then process after the fact. 

 

 

0 0
replied on March 15, 2017

Sorry for the late reply. See this other thread for the cause.

In your case though, it looks like you're running the For Each Entry activity so you can count how many results are in each category of documents (new vs existing unclassified documents). I'd suggest adding that criterion to the Search Repository's query and using the Result Count tokens. You'd have to run 2 searches: one for unclassified documents created more than 7 days ago and one for unclassified documents created in the last 7 days.

0 0
replied on March 15, 2017

Any update or further information on this?

I am having the same issue with a 'Find Entry,' retrieving creation date. When I put that into the a date token calculator i get the "String was not recognized as a valid DateTime."

There must a fix for this as Laserfiche seems to have trouble reading its own assigned date? 

 

You are not allowed to follow up in this post.

Sign in to reply to this post.