Dear Christrian,
I)
Event Handler "Open Notebook"there is no event handler that is triggered when opening the notebook. For an overview of existing event handlers, please have a look into the help file of the development toolkit environment.
II)
Counting Instances using an Expression Attribute
in order to solve your questions, an option is to use the attribute type "EXPRESSION" combined with an AQL statement. Attributes of type EXPRESSION are dynamically calculated within an open model. Please be careful when using EXPRESSION attributes that access information in referenced models (e.g. following INTERREFs using EXPRESSIONS), since all models must be loaded to update these expressions.Please find the expression attribute below, also included in the demonstration implementation available via the Application Library Repository at:
https://www.adoxx.org/svn/all-repo/5_ADOxx_SupportLibraries_ADOxx13UL1/CountingInstancesExpression_ADOxx13UL1/1EXPR type:integer expr:fixed: (tokcnt(aql("<\"A\">")))
type: specifies the return value of the expression, possible values are: double, string, integer, time
fixed: specifies if the expression will be unchangeable in the Modelling Toolkit. It means that the EXPRESSION attribute evaluates the same formula everywhere.