1

I would like to use ftSearch in ServerSideJavascript but I cannot go beyond with datetime value of field. What i want to do is I would like to get all Document after a specified Datetime not only date. I need Date and exac time together with.

var cDate:NotesDateTime = doc.getItemValueDateTimeArray("createdAt").elementAt(0);
var dateFormatter = new java.text.SimpleDateFormat("dd.MM.yyyy hh:mm:ss" ); 
var query = "(FIELD Form=\"Calculate\" AND FIELD Location= \"" + lks+ "\"";
query+= " AND FIELD _createdTime>" + cDate; 
query+=")";
var dc:NotesDocumentCollection = database.FTSearch(query, 0);

EveryTime i get this error
ERROR: java.lang.IllegalArgumentException: Cannot format given Object as a Date"

DateTime Field properties like this **

Field Name: createdAt
Data Type: Time/Date
Data Length: 8 bytes
Seq Num: 1
Dup Item ID: 0
Field Flags: SUMMARY 
11.03.2019 15:54:10 ZE3

**

UPDATE V2 I get an error If i use date with time. is it possible to use it like below..
Exception occurred calling method NotesDatabase.FTSearch(string, number) Notes error: Query is not understandable
((FIELD Form="FormName" AND FIELD Location= "Test" AND FIELD cDate>21.03.2019 10:54:20))

Cumhur Ata
  • 809
  • 6
  • 18

1 Answers1

1

Convert your cDate to Java Date and then to String.
Replace cDate in query with:

dateFormatter.format(cDate.toJavaDate())
Knut Herrmann
  • 30,880
  • 4
  • 31
  • 67
  • I get an error If i use date with time. is it possible to use it like below..
    Exception occurred calling method NotesDatabase.FTSearch(string, number) Notes error: Query is not understandable ((FIELD Form="FormName" AND FIELD Location= "Test" AND FIELD cDate>21.03.2019 10:54:20))
    – Cumhur Ata Mar 29 '19 at 13:37
  • I could not write correct syntax of this ftSearch string...:(( – Cumhur Ata Mar 29 '19 at 13:40
  • Check/test the syntax for query in Notes Client full text search. When it works there it will work here in code. – Knut Herrmann Mar 29 '19 at 14:04