Using Java to Read Record Data in ClassForm for ARS 7.0

Using Java to Read Record Data in ClassForm for ARS 7.0

////////////////////////////////////////////////////////////////////////////
///Start Query Records By Qualification/////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////

Entry entry;
//Prepare to Query a Form on ARSystem 7.0

NameID formName = new NameID(getClassName());
//Set the Field criteria to retrieve all field info
//———————————————————————-
FieldCriteria fCriteria = new FieldCriteria();
fCriteria.setRetrieveAll(true);

//Retrieve all types of fields
//———————————————————————-
FieldListCriteria fListCrit =
new FieldListCriteria(formName, new Timestamp(0),
FieldType.AR_ALL_FIELD);

//Load the field array with all fields in the test form
//———————————————————————-
Field[] formFields = FieldFactory.findObjects(userInfo,
fListCrit, fCriteria);

//Create the search qualifier
//———————————————————————-
QualifierInfo myQualifier = Util.ARGetQualifier(userInfo,
getSearchString(), formFields, null,
Constants.AR_QUALCONTEXT_DEFAULT);

FieldFactory.getFactory().releaseInstance(formFields);

//Set the EntryListCriteria
//———————————————————————-
EntryListCriteria listCriteria = new EntryListCriteria();
listCriteria.setSchemaID(formName);
listCriteria.setQualifier(myQualifier);

//Define which fields to retrieve in the results list
//Note that the total width including separators must be <256 chracters
//Here the total width=15+12+25+3*1=58
//3*1 is three separators of 1 character each
//———————————————————————-
EntryListFieldInfo[] entryListFieldList =
new EntryListFieldInfo[getUsedFieldIds().length];

for (int i = 0; i < getUsedFieldIds().length; i++) {
entryListFieldList[i] = new EntryListFieldInfo(
new FieldID(Long.parseLong(getUsedFieldIds()[i].toString())),
5, ” “);
}
//Set the Entry Criteria
//———————————————————————-
EntryCriteria criteria = new EntryCriteria();
criteria.setEntryListFieldInfo(entryListFieldList);

//Make the call to retrieve the query results list
Integer nMatches = null;

//Set it to false to return all entries regardless of locale
//———————————————————————-
Entry[] entryInfo = EntryFactory.findObjects(userInfo,
listCriteria, criteria, false, nMatches);

log.debug(“Query returned===” + entryInfo.length + ” matches.”);

for (int i = 0; i < entryInfo.length; i++) {

for (int ii=0;ii<entryInfo[i].getEntryItems().length-1;ii++)  {

try {

log.debug(ii+ “.)Value===” + entryInfo[i].getEntryItems()[ii].getValue().toString() + “====” );

} catch (NullPointerException ex) {
log.debug(i + “.)” + ex.getLocalizedMessage());
}

}
}

///////////////////////////////////////////////////////////////////////////////
///End Query Records By Qualification/////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

Comments are closed.