UnifaceEntity.getNumberOfOccurrences

This method retrieves the current number of occurrences in this entity.

int getNumberOfOccurrences ( )

Return Values

Current number of occurrences in this entity.

UnifaceEntity.getNumberOfOccurrences

The following example defines a UnifaceEntity for the repository entity PRATT, calls the service getent in operation SPRATT (which returns all the PRATT entity occurrences), and sets the Java field jTextStatus to the number of occurrences retrieved.

// create bean for operation Spratt
SprattBean sprattBean1 = new SprattBean();

// Uniface specific variables
int fieldTypes[] = { // define entity layout
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 ; // declare entity

// call operation getents in service spratt to populate entity try {
ent = new UnifaceEntity (fieldTypes); // create entity
ent = sprattBean1.getents(ent);
}
catch (UnifaceException exc) {// operation failed
return;
jTextStatus.setText("Error: " + exc.getMessage());
}
// update status
jTextStatus.setText( "Number of occurrences : " +
ent.getNumberOfOccurrences());