How to find no of Definition copies and Occurrence Copies present in a model ?
5 Replies
-
Please define the difference between definition and occurrence copy...
-
in reports:
if (oObjDef.OccListInModel ( oModel ).length==0){
// no objoccurences in model
}if (oCxnjDef.OccListInModel ( oModel).length==0){
// no cxnoccurences in model
}in macro's:
var sGUID = Designer.getGUID(oObjDef)
var iTeller =0
var aOccs = Designer.getOccs ( oModel)
for each (var Occ in aOccs){
var oObjDef = Designer.getDefinition(Occ)
if (Designer.getGUID(oObjDef) == sGUID) iTeller ++
}
notice:
getOccs returns the occurrences within a model. This function only returns ungrouped occurrences, i.e. for grouped occurrences, only their grouping is returned:
if (oOcc.getItemKind == Constants.CID_UNION){
var oUnion = oOcc
var aOccsInUnion = Designer.getUnionMembers ( Model model, oUnion)
}
-
Occurrence copies:
Occurrence copies are used when objects are re-used in more than one process model. The two occurrences in the models are one single database object in the database. Usually there is an object repository in the database for all re-used objects. Occurrence copies can be used for objects as well as for whole models:
• When creating process models that are similar to a model that already exists. The existing model is copied and changed to the requirements of the new model.
• When changing one object in the repository, the changes are visible at every model that uses the object
Copying by short keys - Occurrence copy: Ctrl+C, Ctrl+VIf there is already an existing object with the same name (but the two objects are independent from each other), you have to create a definition copy.
Definition copies :
Definition copies are created on the database when creating new objects on the modeling space. Even though two objects have the same name other they are independent from each other.
Copying by short - Definition copy: Ctrl+C, Ctrl+Shift+V -
Well, yes, I do know the difference - I wanted you to think about your question to get the answer...
There is no such thing as occ copy and def copy IN a model. There is always only occurrences of objects in a model which you get by Model.ObjOccList().
You can then iterate through those and check if they have occurrences in other models.
-