0
votes

I am trying to upload the data from a delimited text file to the lotus notes form using java agent. The issue arises when I try to insert the date value to the notes document. After insert when i use ComputeWithForm, then it returns false. I am using simpledateformat to format the date in MM/dd/yyyy format, but it is still not working. Below is the excerpt from my code.

         String delim, key,  thekey, myDate;
            Date date = new Date();
            SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy);
            myDate = dateFormat.format(date);
newdoc.replaceItemValue("UploadDBDate", myDate);

Any help will be great.

Thanks, Himanshu

2
do you want the field value stored as text or date?Michael Ruhnau
Field needs to be stored as dateHimanshu.MarJAVA

2 Answers

2
votes

myDate is a String object. The replaceItemValue method does not know that you have put a date into that String, therefore it treats it as ordinary text. If uploadDBDate is a DateTime field, that causes a type mismatch during the computeWithForm operation.

The Lotus classes for Java include a DateTime class. The Session class has a createDateTime method that you pass a "mm/dd/yyyy" string and return a DateTime object. Then you can pass that DateTime object into replaceItemValue instead of passing in myDate.

0
votes

I would recommend you to do those things: 1) disable computewithform and simply save document and then verify field UploadDBDate, does it have correct value? does it have corrrect type? 2) if everything is fine with UploadDBDate then there is a problem on a form, so try to investigate what calculation you do on the form, because problem is there.