UNSOLVED

les5

updated

19 years ago

L

les5

1 Message

0

590

November 26th, 2007 16:00

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
  • 216

    0

    Posted November 27th, 2007 09:00

    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
  • hhe

    13 Posts

    216

    0

    Posted 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