Skip to content

GET_ALL_OBJS_OF_CLASSNAME

The command GET_ALL_OBJS_OF_CLASSNAME retrieves all instances (not relations!) of the given class in the given model!

Syntax

leo-grammar
CC "Core" GET_ALL_OBJS_OF_CLASSNAME model:idValue classname:strValue


#-->RESULT ecode:intValue objids:list
CC "Core" GET_ALL_OBJS_OF_CLASSNAME model:idValue classname:strValue


#-->RESULT ecode:intValue objids:list

Parameters

  • modelid (idValue) - the parameter modelid specifies the model from which we want the instances.
  • classname (strValue) - the parameter classname specified the lookup class.

Returns

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

Details

See Also

Examples

asc
# get current model
SEND "GET_ACTIVE_MODEL" to:"Modeling" answer:modelid

IF (LEN (modelid) = 0)
{
  CC "AdoScript" ERRORBOX ("Please open a model!")
  EXIT
}

# get all objs of class
CC "Core" GET_ALL_OBJS_OF_CLASSNAME modelid:(VAL modelid) classname:"Aktivität"

IF (LEN (objids) = 0)
{
  CC "AdoScript" ERRORBOX ("You have no instances of class 'Aktivität'!")
  EXIT
}

# get name of first object
CC "Core" GET_OBJ_NAME objid:(VAL token (objids, 0, " "))

CC "AdoScript" INFOBOX ("First 'Aktivität' found is called '" + (objname) + "'")
# get current model
SEND "GET_ACTIVE_MODEL" to:"Modeling" answer:modelid

IF (LEN (modelid) = 0)
{
  CC "AdoScript" ERRORBOX ("Please open a model!")
  EXIT
}

# get all objs of class
CC "Core" GET_ALL_OBJS_OF_CLASSNAME modelid:(VAL modelid) classname:"Aktivität"

IF (LEN (objids) = 0)
{
  CC "AdoScript" ERRORBOX ("You have no instances of class 'Aktivität'!")
  EXIT
}

# get name of first object
CC "Core" GET_OBJ_NAME objid:(VAL token (objids, 0, " "))

CC "AdoScript" INFOBOX ("First 'Aktivität' found is called '" + (objname) + "'")
  • get active model's id
  • determine all instances of class "Aktivität"
  • check if any instance was found
  • get name of first instance and show infobox

Versions and Changes

Available since ADOxx 1.3