Skip to content

REMOVE_ALL_INTERREFS

REMOVE_ALL_INTERREFS removes all references from an interref attribute.

Syntax

leo-grammar
CC "Core" REMOVE_ALL_INTERREFS objid:idValue attrid:idValue .


#-->RESULT ecode:intValue
CC "Core" REMOVE_ALL_INTERREFS objid:idValue attrid:idValue .


#-->RESULT ecode:intValue

Parameters

  • objid (idValue) - the ID of the object which is owner of the attribute has to be passed as argument objid.
  • attrid (idValue) - the ID of the INTERREF attribute has to be passed as argument attrid.

Returns

  • ecode (intValue) - Contains the error code or is 0 in case of success.

Details

See Also

Examples

asc
# get all selected objects
CC "Modeling" GET_SELECTED
IF (objids = "") {
    CC "AdoScript" ERRORBOX "No object has been selected!"
    EXIT
}

# from the list of selected objects, extract the first objectid
SET selected:(VAL token(objids,0," "))

# get the class of the selected object
CC "Core" GET_CLASS_ID objid:(selected)

# get all attributes
CC "Core" GET_ALL_ATTRS classid:(classid)

# for each attribute, check if it is an interref attribute
FOR attrid in:(attrids) {
    CC "Core" GET_ATTR_TYPE attrid:(VAL attrid)
    CC "Core" GET_ATTR_NAME attrid:(VAL attrid)
    IF (attrtype = "INTERREF") {
        # for each interref attribute, get all interrefs
        CC "Core" REMOVE_ALL_INTERREFS objid:(selected) attrid:(VAL attrid)
   }
}

# show info
CC "AdoScript" INFOBOX "All references of the selected instance have been removed!"
# get all selected objects
CC "Modeling" GET_SELECTED
IF (objids = "") {
    CC "AdoScript" ERRORBOX "No object has been selected!"
    EXIT
}

# from the list of selected objects, extract the first objectid
SET selected:(VAL token(objids,0," "))

# get the class of the selected object
CC "Core" GET_CLASS_ID objid:(selected)

# get all attributes
CC "Core" GET_ALL_ATTRS classid:(classid)

# for each attribute, check if it is an interref attribute
FOR attrid in:(attrids) {
    CC "Core" GET_ATTR_TYPE attrid:(VAL attrid)
    CC "Core" GET_ATTR_NAME attrid:(VAL attrid)
    IF (attrtype = "INTERREF") {
        # for each interref attribute, get all interrefs
        CC "Core" REMOVE_ALL_INTERREFS objid:(selected) attrid:(VAL attrid)
   }
}

# show info
CC "AdoScript" INFOBOX "All references of the selected instance have been removed!"

Versions and Changes

Available since ADOxx 1.3