Frank Yuan
Frank Yuan

Reputation: 131

Query date range for date saved in a text field in IBM Notes and Domino

There is a date saved in a text field. I'm trying to get documents collection when the field is in a date range using db.FTSearch method. But > and < doesn't work in a text field. Are there any way to convert text field? I'm not familiar with IBM Domino and have tried @TextToTime but doesn't work.

Upvotes: 0

Views: 754

Answers (2)

D.Bugger
D.Bugger

Reputation: 2359

A few ways:

  1. use db.Search instead of db.FTSearch; the syntax is completely different though, plus it is rather slow, but if you have to execute your query once per day or even less, you're fine
  2. write an agent that converts the text date fields into new real date fields, so you can do your FTSearch; make sure you adapt the form used to create the documents, so that it also creates those date fields
  3. use a view, where the first 2 columns contain the date value of your text fields, and sort the view; you'd have to use getDocumentByKey (but I'm not sure this works)

Upvotes: 1

Richard Schwartz
Richard Schwartz

Reputation: 14628

Your date is stored as text, so you need to use @TextToTime().

I.e.,

 FIELD @TextToTime(field1) >= [01/01/2018] AND
 FIELD @TextToTime(field1) <= [01/19/2018]

Upvotes: 0

Related Questions