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

Question

Question

Curious and incorrect results from a Date Field Search

asked on July 1 Show version history

Using LF 11 and the web client 11.0.2109.7) we are having an odd issue when searching on a date field.  The documents in question all have a template field named Document Date, with a value of 12-30-2025.

 

The field definition is standard, except we use a custom format:

 

 

Searching for data > then our value, or >= our value, 

Gives us one of the results we asked for, but also gives us items that are not relevant.  This is true whether we use the date picker of edit advanced search syntax. Also, it does not make a difference if we edit the Advanced Search Syntax for YYYY-mm-DD or mm-DD-YYYY.

 

Comparing this to the V11 Win client, the field automatically presents itself as a range:

 

With different search syntax:

 

 

So I am wondering if the Web Client is not rendering the Date field correctly.

0 0

Answer

SELECTED ANSWER
replied two days ago Show version history

Try changing your custom format to use lowercase y instead of uppercase Y for the year. They actually mean slightly different things that are relevant near the end of the year: https://stackoverflow.com/questions/15133549/difference-between-yyyy-and-yyyy-in-nsdateformatter

1 0

Replies

replied on July 1

The main thing to keep in mind that any kind of formatting (including custom formatting) only affects the display. Dates are stored in the back-end as sql dates, no matter what your display options are. The other thing is that the advanced search syntax has defined ways to specify a date, and they don't depend on custom formatting. So the search syntax in the Windows client screenshot is the correct way to run your search. What do you get if you enter that same syntax into the web client? What happens if you run the date search in the web client without using advanced syntax?

As for whether the web client is rendering the date value correctly or not, the easiest way to tell would be to open both clients up to the same folder and see if the listings match. They should both be applying the same formatting to the field values.

2 0
replied on July 2

Thanks Brian - 

We ran more tests, using the Web Client fields, and then displaying the syntax as it is generated by the search engine. We are looking for four documents with a value of 12-30-2025.

Test 1:

This search produced one record, with a date of 12-30-2026 (not 2025)

Changing this search to: >= "2025-12-29" produced 21 results, including 12-30-2026, and 20 others with different dates, and none with a data of 12-30-2025.  (Again the year being different)

Test 2:

Changing the date to 12-30-2025, and setting the operator to = gave us one result, the document with a data of 12-30-2026 (not 2025)

Changing the operator to >= gave us the same 21 results described above in Test 1.

We will repeat this using the syntax addition you suggested, and also using the Windows Client.

 

 

 

0 0
replied on July 3 Show version history

The plot thickens: Working with a single document, we have a display value of:

 

And a database value from propval of: 

date_val

2024-12-30 00:00:00.000

The value in the database is stored correctly, but it does not display correctly.  Note that the field has a formatting mask of YYYY-mm-DD.

 

Let's make this more weird: I get the same behavior when I import a briefcase containing a document from the client's system. But, when I create documents using the same template, it works perfectly.  Flipping this to support now.

 

 

0 0
replied on July 3

Have you tried formatting the date as "2025/12/30" intead of "2025-12-30" in the search syntax?  

The Advanced Search Syntax guide says it should allow dashes in addition to slashes - but I know the default that the search syntax uses is slashes, and your screenshot from the Desktop Client has slashes, while all your screenshots from the Web Client that are not working have dashes.

0 0
replied two days ago

Yes, we have tried a number of different formats, changing dashes to slashes, using mm-DD-YYYY instead of YYYY-dd-MM.  I have a briefcase from them, and when I import it, it stores the date correctly in the DB, and displays it as date + 1 year. ??

 

However, when I create a new document on our test system, using the same template, it stores and displays correctly.

0 0
SELECTED ANSWER
replied two days ago Show version history

Try changing your custom format to use lowercase y instead of uppercase Y for the year. They actually mean slightly different things that are relevant near the end of the year: https://stackoverflow.com/questions/15133549/difference-between-yyyy-and-yyyy-in-nsdateformatter

1 0
replied two days ago

Amazing, Brian, that exactly solved the problem.  We noticed today that the only dates impacted came out the end of the year:  12/27 or 12/28 for 2025 and 2026 respectively.  Looking at the article, I can see why. That's a great find!

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

Sign in to reply to this post.