Nuri Ensing
Nuri Ensing

Reputation: 2030

how to get datetime value from field with java in lotus

I use IBM notes and IBM Domino designer. I have a form with a date/time field. This field is called 'Orderdatum', from a java agent I call this field by eventually doing this:

orderDocument.getItemValueDateTimeArray("Orderdatum")

If it's filled in then it works, but if it's empty then I get this:

NotesException: Item value is not a date type
    at lotus.domino.local.Document.NgetItemValueDateTimeArray(Native Method)
    at lotus.domino.local.Document.getItemValueDateTimeArray(Unknown Source)
    at JavaAgent.postOrder(Unknown Source)
    at JavaAgent.NotesMain(Unknown Source)
    at lotus.domino.AgentBase.runNotes(Unknown Source)
    at lotus.domino.NotesThread.run(Unknown Source)

Even if I do checks like:

if(orderDocument.getItemValueDateTimeArray("Orderdatum") != null){
if(!orderDocument.getItemValueDateTimeArray("Orderdatum").equals(null)){

I still get the error in my console, how to avoid this.

Upvotes: 2

Views: 1172

Answers (1)

Knut Herrmann
Knut Herrmann

Reputation: 30960

Use this:

if(orderDocument.getItemValue("Orderdatum") != null){

Upvotes: 4

Related Questions