Hi all,
I want to retrieve the content of a diary field in ARS (5.1) using Java API but following code does not retrieve any string value( because .getDiary() returns null). Do you have an idea about the reason? How can I solve this problem?
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
FieldCriteria fcrit = new FieldCriteria();
fcrit.setRetrieveAll(true); // Get all field info
FieldListCriteria fListCrit = new FieldListCriteria(schemaName,new Timestamp(0),FieldType.AR_ALL_FIELD); // Get all field types
// Load the field array with all fields in the form
Field[] formFields = FieldFactory.findObjects(context,fListCrit,fcrit);
Diary di[] = new Diary[100]; // Diary array
DiaryInfo[] d1 = new DiaryInfo[100]; // DiaryInfo array
String s1 = "";
String s2 = "";
String s3 = "19.07.2006 17:29:02 as_db" +
"Status = zugeteilt gesetzt von as_db (Bearbeiter: xxx, Betreuer: xxx) an/ bei as_test (Priorität: 2 hoch, Nachfrage: , Problemgliederung: application:ecs:delta_test)" +
"----------------------------------------" +
"19.07.2006 17:29:30 as_db" +
"Status = angenommen gesetzt von as_db (Bearbeiter: xxx, Betreuer: xxx) an/ bei as_test (Priorität: 2 hoch, Nachfrage: , Problemgliederung: application:ecs:delta_test)" +
"----------------------------------------";
System.out.println (s3.length());
// s3 is longer than 255 chars. It is a typical diary field string.
for (int i=0; i<100; i++){
if (formFields[i].getDataType() == DataType.DIARY)
// if field data type is “diary”
{
di[i] =
new Diary( ((ObjectBase)formFields[i]).getDiary());
// field.getDiary() returns null.. But expected return value is a string.
di[i] = new Diary(formFields[i].getDiary());
// same as the line above, but without casting to ObjectBase Class
d1 = di[i].decode(context);
// it does not function because di[i] = null
// d1 = Util.ARDecodeDiary(formFields[i].getDiary())
// Same as the line above.
}
}
System.out.println (d1); // displays nothing – runs exception
BUT IF WE DO “formFields[i]).setDiary(s3)” BEFORE “formFields[i]).getDiary()”, everything works fine!
In this case, formFields[i].m_string is filled with the content of s3 (otherwise it is null), and if we perform getDiary() afterwards, it returns the string s3.
How can I retrieve the content of diary field using getDiary() without performing a setDiary(s) before? (Of course the diary field is not empty.. It is filled with tester/developer comments etc..)
Or is there another way to retrieve the content of Diary Field? (any code samples will be very helpful..)
Thanks,
Bilge Erkan