Up Previous Next Title Page Index Contents

5.10.4 Checking instance uniqueness

To check that a given object type only has one instance per graph, you would normally use an Occurrence Constraint in the graph type. You could also use the following generator definition:
Report 'Check XYZ instances'
subreport '_translators' run
$occurrences='0'
foreach .XYZ { $occurrences++%null }
if $occurrences > '1' num then
   'Object type XYZ found '
   $occurrences
   ' times in this graph:' 
   foreach .XYZ 
   {  id newline 
   } 
endif
endreport
When the generator is run on a graph containing more than one occurrence of XYZ, an output window will report the number and names of XYZ objects. Each object name can be double-clicked to take the user to the object. If no duplicates are found, no output window is opened.

Up Previous Next Title Page Index Contents