Unsolved
This post is more than 5 years old
1 Message
0
506
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
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
FredericMeunier_0588be
143 Posts
0
November 27th, 2007 09:00
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
hhe
13 Posts
0
February 25th, 2014 22:00
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