Dear Fadi,
Thank you for your question. To realize your scenario you have to compare two lists of target object ids:
1) The target object id list before deleting
2) The target object id list after deleting
In order to receive these list of ids you have to parse the old and the new attribute value of "Participating". Please find below the example that delivers you the target object id of the deleted interref. Which you can also find in the attached AdoScript file.
1ON_EVENT "SetAttributeValue" {
2
3SETG nCurrentObjID: (instid)
4SETG oOldValue: (oldval)
5SETG nCurrentModelID: (modelid)
6SETG nCurrentAttrID: (attrid)
7
8CC "Core" GET_CLASS_ID objid: (nCurrentObjID)
9SET nCurrentClassID: (classid)
10CC "Core" GET_ATTR_ID classid: (nCurrentClassID) attrname: "Participating"
11SET nParticipatingAttrID: (attrid)
12# only continue if the correct ID
13IF (nCurrentAttrID = nParticipatingAttrID) {
14 CC "Core" GET_ATTR_VAL objid: (nCurrentObjID) attrname: ("Participating")
15 SET oNewValue: (val)
16 IF (LEN oOldValue > LEN oNewValue) {
17
18 ##########################################
19 # Get target Ids of the deleted InterRefs#
20 ##########################################
21
22 # Get list of the InterRefs of the NEW Attribute Value with parsing the InterRefs after calling all outgoing InterRefs
23 CC "Core" GET_ALL_INTERREFS_OF_ATTR objid: (id_InstId) attrid: (nCurrentAttrID)
24 SET s_IntReftext: (reftext)
25 SET listIds:""
26 FOR i in: (s_IntReftext) sep:"\n" {
27 SET parseExp: (i)
28 IF (parseExp!="") {
29 # Search for target object id with parsing a LEO expression
30 LEO parse: (parseExp) get-str-value:str_ToObjId:"tobjid"
31 # If you want to obtain target modelid than enter "tmodelid" instead of "tobjid"
32 # Save in a list
33 SET listIds: (tokunion(listIds,str_ToObjId))
34 }
35 }
36
37 # Get list of the InterRefs of the OLD Attribute Value with parsing the attribute value
38 SET olistIds:""
39 FOR j in: (oOldValue) sep:"\n" {
40 SET oparseExp: (j)
41 IF (oparseExp !="") {
42
43 #Obtain the several values of the Interref by LEO parse
44 LEO parse: (oparseExp) get-str-value:str_oToObjName:"i"
45 LEO parse: (oparseExp) get-str-value:str_oToModelType:"mt"
46 LEO parse: (oparseExp) get-str-value:str_oToModel:"m"
47 LEO parse: (oparseExp) get-str-value:str_oToClassId:"c"}
48
49 #Get target object ids and save them in a list
50 CC "Core" GET_MODEL_ID modelname: (str_oToModel) modeltype: (str_oToModelType)
51 SET nReferencedModelId: (modelid)
52 CC "Core" GET_CLASS_ID classname: (str_oToClassId)
53 SET nReferencedClassId: (classid)
54 CC "Core" GET_OBJ_ID modelid: (nReferencedModelId) classid: (nReferencedClassId) objname: (str_oToObjName)
55 SET noToObjId: (objid)
56 SET olistIds: (tokunion(olistIds,STR noToObjId))
57 }
58
59 # Compare and make the difference between the old and the new value
60 SET l_DeletedTargetIdsOfInterRefs: (tokdiff(olistIds,listIds))
61 CC "AdoScript" INFOBOX (l_DeletedTargetIdsOfInterRefs)
62 }
63}
64}
As the InterRef "Participating" is an object reference the example delivers the deleted objids and not the modelids. But the principle of the implementation would be the same.
.