Skip to content

GET_INTERREF_COUNT

GET_INTERREF_COUNT returns the number of references contained in an INTERREF attribute value.

Syntax

leo-grammar
CC "Core"	
GET_INTERREF_COUNT	objid:idValueAttrSpec .
CC "Core"	
GET_INTERREF_COUNT	objid:idValueAttrSpec .

AttrSpec : attrid:idValue| attrname:strValue .

leo-grammar
#-->RESULT ecode:intValue count:anyValue
#-->RESULT ecode:intValue count:anyValue

Parameters

  • objid (idValue) - the argument objid has to be set to the ID of the instance.
  • attrid (idValue) - the argument attrid has to be set to the ID of the attribue.
  • attrname (strValue) - alternatively the name of an attribute can be specified with attrname.

Returns

  • ecode (intValue) - contains the error code or is 0 in case of success.
  • count (anyValue) - , the return variable count is set to the number of references that are contained in the accessed attribute value.

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
SET result:"Interref attributes:\n\n"
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" GET_INTERREF_COUNT objid:(selected) attrid:(VAL attrid)
      SET result:(result+attrname+" has # references: "+STR count+"\n")
   }
}
# display the result
CC "AdoScript" INFOBOX (result)
# 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
SET result:"Interref attributes:\n\n"
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" GET_INTERREF_COUNT objid:(selected) attrid:(VAL attrid)
      SET result:(result+attrname+" has # references: "+STR count+"\n")
   }
}
# display the result
CC "AdoScript" INFOBOX (result)

Versions and Changes

Available since ADOxx 1.3