- Function AttributeLength(IdentifierName, AttributeName)
AttributeLength
The function AttributeLength
returns the length of a string representation
of a specified attribute for a given identifier.
AttributeLength(
IdentifierName, ! (input) scalar element parameter
AttributeName ! (input) scalar element parameter
)
Arguments
- IdentifierName
An element expression in the predefined set
AllIdentifiers
specifying the identifier for which an attribute length has to be returned.- AttributeName
An element expression in the predefined set
AllAttributeNames
specifying the attribute.
Return Value
This function returns the length of a string representation of the attribute on success or zero otherwise and the predeclared identifier
CurrentErrorMessage
contains an appropriate error message.
Example
Given the declaration:
Parameter p {
Comment: "Hello""}
inside the nested module chapterModel::sectionModelQuery::funcAttributeLength
,
the code that queries the comment attribute of identifier p
is:
1_ep_p := StringToElement(AllIdentifiers,
2 "chapterModel::sectionModelQuery::funcAttributeLength::p",
3 create: 0);
4_p_cmt := AttributeLength(_ep_p, 'comment');
5block where single_column_display := 1, listing_number_precision := 6 ;
6 display { _ep_p, _p_cmt };
7endblock ;
Remark:
Lines 1-3: Note that the name of the identifier contains all prefixes of the modules it is in.
The results in the listing file:
_ep_p := 'chapterModel::sectionModelQuery::funcAttributeLength::p' ;
_p_cmt := 5 ;