les5
1 Copper

Accessing another element's attribute within a model file

Hi all, I am attempting to do the following:

event somethingHappened = ClassName(localRelation)->ClassAttribute == 2

I.e. I want an event to fire whenever another model object related via a relationship has an attribute value of "2" for example.

Anyone know how to achieve such a thing? I get an error that "ClassName is not of type MR_Object"

Les
0 Kudos
2 Replies
8 Krypton

Re: Accessing another element's attribute within a model file

Hi Les,

if I understand what you want to acheive, you can:
(1) use a propagated attribute to propagate the ClassAttribute of ClassName to the other object,
(2) make your event use the propagated attribute.

Something like:
--------------------------------------------------------------------
interface A
{
attribute short thisAttribute;
relationship relationAToB, B, relationBToA;
}

interface B
{
propagate attribute short thisAttributeFromA = A, relationBToA, thisAttribute;
relationship relationBToA, A, relationAToB;
}
--------------------------------------------------------------------

Note: I did not compile this, look at the MODEL pdf file to use the right syntax.
To consider:
- if you are using a relationshipset, you have to use an aggregate operator for thisAttributeFromA,
- maybe the event is a symptom, and the symptom propagates itself, so you may consider using a symptom in A which propagates to B... depending of the nature of your model.

Hope this helps,

--Fred

Frederic Meunier
Solutions Watch4Net Inc
APG & Smarts InCharge integration
http://www.watch4net.com
0 Kudos
hhe
6 Indium

Re: Accessing another element's attribute within a model file

Propagate only works for integer and boolean type of attributes, but doesn't work for string.

How to handle the string attribute then ?

I am currently having some issues and still struggling here.

Any advise would be much appreciated.

Cheers,

Hubery

0 Kudos