UnifaceEntity.getOccurrenceField

Return the contents of the specified field as a Java object.

import com.compuware.uniface.*;

Object getOccurrenceField(

intoccNumber,

intfieldNumber);

Parameters

  • occNumber—number of the occurrence.

  • fieldNumber—required field’s number, starting from one.

Return Values

Return the contents of the specified field as a Java object. It throws a UnifaceException if the field number does not exist.

UnifaceEntity.getOccurrenceField

The following example extracts the values of four fields from the occurrence specified by currentOccurrence, from the entity declared as ent.

int currentOccurrence;
int fieldTypes[] = {
Values.UTYPE_STRING,
Values.UTYPE_STRING,
Values.UTYPE_STRING,
Values.UTYPE_STRING,
Values.UTYPE_STRING,
Values.UTYPE_STRING,
Values.UTYPE_STRING,
Values.UTYPE_STRING,
Values.UTYPE_STRING,
Values.UTYPE_STRING,
Values.UTYPE_STRING,
Values.UTYPE_STRING
};
UnifaceEntity ent ;
// other initialization code
ent = new UnifaceEntity (fieldTypes);
// code (not shown) that populates ent
try {
// get values from fields in current occurrence
Object f1 = ent.getOccurrenceField(currentOccurrence,1);
Object f2 = ent.getOccurrenceField(currentOccurrence,2);
Object f3 = ent.getOccurrenceField(currentOccurrence,3);
Object f4 = ent.getOccurrenceField(currentOccurrence,4);
}
catch (UnifaceException exc) {
jTextStatus.setText("Error: " + exc.getMessage());
return;
}