Hello
I m trying to work on a macro trigered with the event "l'objet doit étre changé lors de la modélisation"
If an attribut if changed with modeling a treatement will be executed based on the new value of the attribut.
The macro is trigered before i set the new value of the attribut and not after, so the argument withe the key 1 (the new value of the attribut) is always empty.
this is my code traiting the event :
var id = Context.getProperty(Constants.EVENT_ID)
var arg = Context.getProperty(Constants.EVENT_ARGUMENTS)
var keys = arg.getKeys()
var arguments = new String();
for(var i=0; i<keys.length; i++)
arguments = arguments + keys[i]+ ": " + arg.getValue(keys[i]) + "\n";
Dialogs.MsgBox("Event: "+id+"\n"+arguments)
The argument with the key 1 is always : ?
Thanks for your help
Omar
Hello Omar,
obviously the new attribute value needs to saved befor you can evaluate it, so the trigger EVENTID_OBJECT_ATTRIBUTES_CHANGED should do the trick.
The property EVENT_ARGUMENT_ATTRIBUTES
gives the list of changed attribute names by which you can get the saved attribute value.
But you should consider that this macro may be triggered quite often and slow down modeling. If you want to react to the value of exactly one attribute you could reduce load listening to EVENTID_MODEL_BEFORE_SAVE instead.
Regards, Martin
Hello Martin,
Thanks for the reply,
In a recent release of Aris, the event i used worked, the attribut is changed and then the macro is trigered and i can get the new value of the attribut. It does slow down the modeling,
What i m tring to do is fill attributs based on the value of other : Exempel : the gravity of a risk based on impact and probability and so on.
Also there is another feature that i needed in this context : is attribut with selectble value based on the value of another attribut : If Attribut A=1, Attribute B can be 1.1; 1.2 or 1.3
If Attribut A=2, Attribute B can be 2.1; 2.2 or 2.3
But support said this is not possible in Aris.
Regards, Omar