Skip to content

GET_ALL_REC_ATTR_ROW_IDS ​

GET_ALL_REC_ATTR_ROW_IDS returns the IDs of all rows of a RECORD attribute value.

Syntax ​

leo-grammar
CC "Core" GET_ALL_REC_ATTR_ROW_IDS objid:idValue attrid:intValue

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

#-->RESULT ecode:intValue rowids:intValue .

Parameters ​

  • objid (idValue) - the ID of the object
  • attrid (intValue) - the ID of the attribute

Returns ​

  • ecode (intValue) - Contains the error code or is 0 in case of success.
  • rowids (strValue) - holds the list of IDs of the record attribute value, separated by blanks.

Details ​

See Also ​

ADD_REC_ROW
MOVE_RECORD_ROW
REMOVE_REC_ROW
GET_REC_ATTR_ROW_ID
GET_REC_CLASS_ID
GET_REC_ATTR_ROW_COUNT
GET_OWNER_OBJ_OF_REC_ROW
GET_RECORD_MULTIPLICITY

Examples ​

asc
# get all selected objects
CC "Modeling" GET_SELECTED
IF (objids = "") {
    CC "AdoScript" ERRORBOX "Select an instance first!"
    EXIT
}

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

# now get the classes of the connected instances
CC "Core" GET_CLASS_ID objid:(VAL firstselected)

# get all attributes of the selected class
CC "Core" GET_ALL_ATTRS classid:(classid)

# get types of attributes
FOR id in:(attrids) {
    CC "Core" GET_ATTR_TYPE attrid:(VAL id)

    # check for type "RECORD"
    IF ((attrtype) = "RECORD") {
        # get attribute name
        CC "Core" GET_ATTR_NAME attrid:(VAL id)

        # here we get all rows
        CC "Core" GET_ALL_REC_ATTR_ROW_IDS
                objid:(VAL firstselected) attrid:(VAL id)

        IF ((ecode) != 0) {
            CC "AdoScript" ERRORBOX ("An error occured in attribute "+(attrname))
            EXIT
        }

        IF ((rowids) = "") {
            CC "AdoScript" ERRORBOX
                    ("Attribute \""+(attrname)+"\" contains no rows!")
            EXIT
        }

        # show actual row count
        CC "AdoScript" INFOBOX
               ("Attribute \""+(attrname)+"\" contains " + STR tokcnt (rowids, " ")
                + " rows:\n" + rowids)
        EXIT
    }
}

# show error
CC "AdoScript" ERRORBOX ("No attributes of type RECORD found!")
# get all selected objects
CC "Modeling" GET_SELECTED
IF (objids = "") {
    CC "AdoScript" ERRORBOX "Select an instance first!"
    EXIT
}

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

# now get the classes of the connected instances
CC "Core" GET_CLASS_ID objid:(VAL firstselected)

# get all attributes of the selected class
CC "Core" GET_ALL_ATTRS classid:(classid)

# get types of attributes
FOR id in:(attrids) {
    CC "Core" GET_ATTR_TYPE attrid:(VAL id)

    # check for type "RECORD"
    IF ((attrtype) = "RECORD") {
        # get attribute name
        CC "Core" GET_ATTR_NAME attrid:(VAL id)

        # here we get all rows
        CC "Core" GET_ALL_REC_ATTR_ROW_IDS
                objid:(VAL firstselected) attrid:(VAL id)

        IF ((ecode) != 0) {
            CC "AdoScript" ERRORBOX ("An error occured in attribute "+(attrname))
            EXIT
        }

        IF ((rowids) = "") {
            CC "AdoScript" ERRORBOX
                    ("Attribute \""+(attrname)+"\" contains no rows!")
            EXIT
        }

        # show actual row count
        CC "AdoScript" INFOBOX
               ("Attribute \""+(attrname)+"\" contains " + STR tokcnt (rowids, " ")
                + " rows:\n" + rowids)
        EXIT
    }
}

# show error
CC "AdoScript" ERRORBOX ("No attributes of type RECORD found!")

Preparing:

  • Get selected objects
  • pick first selected
  • get its class id
  • get all attributes of that class
  • loop for all attributes

Interesting:

  • check for attribute type RECORD

  • get attribute name

  • GET_ALL_REC_ATTR_ROW_IDS

  • check if successful

  • check if rows exists

  • show row ids and exit

  • if no attributes of type RECORD were found: Report error

Versions and Changes ​

Available since ADOxx 1.3