Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi
Tinderbox Users >> Agent, Actions, Rules & Automation >> Multiple conditional attribute assignment
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1405894624

Message started by MJ Mastroianni on Jul 20th, 2014, 6:17pm

Title: Multiple conditional attribute assignment
Post by MJ Mastroianni on Jul 20th, 2014, 6:17pm

Note: I've already submitted a question concerning concerning the firing of actions when moving a note within the inside of an adornment in TB 6.0.2 to Eastgate (which has been assigned an issue number.)

My question is simply, can I have multiple conditional actions in an adornment? For example, how do I get the following behavior:

If a note's $Color is not red and moved into an adornment, change its $Color to red. If a note's $Color is red and moved into the same adornment, change its $Color to poppy. (Thus a note's color will toggle between red and poppy when dragged in and out of the adornment.)

Am I limited to a single if/else clause? Would it be possible to have, say, 4 or 5 conditions tested for that execute additional attribute assignments?

Deeper additional question: can an adornmennt inherit this behavior from a prototype adornment? What is the required conditional then?

Thanks in advance for advice á:)

Title: Re: Multiple conditional attribute assignment
Post by J Fallows on Jul 21st, 2014, 12:44am

I will leave it to one of the Marks to offer specific how-to guidance. But for the threshold question of whether TB can handle complex or conditional or chained queries, my experience is Yes. If you get the right syntax, you can refine this as much as you would like. á

Title: Re: Multiple conditional attribute assignment
Post by Mark Anderson on Jul 21st, 2014, 6:03am

An adornment can use a prototype - it doesn't have to be an adornment though it can make more sense to have a prototype of the same type.

Can an $OnAdd have more that one condition? Yes:

if(conditionA) {
  ůsome code;
} else {
  if(conditionB) {ůsome code;
     if(conditionC) {
        ůsome code;
     }
  }else{
     ůsome code;
 }
};
if(conditionD) {
  ůsome code;
};


Notice that in the case of test 'conditionD' that it runs entirely separate from and after the other 3 nested tests.

if($Color=="red") {
  $Color="poppy";
} else {
  $Color="red";
}


Although notes may start of as any color, those notes interacting with the adornment will end up either red or poppy.

Title: Re: Multiple conditional attribute assignment
Post by MJ Mastroianni on Jul 23rd, 2014, 1:13am

Thank you, that was very helpful :)

Cheers,

Mike


Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com) » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.