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 >> Attribute that depends on children notes
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1421733462

Message started by Ralph Alvy on Jan 20th, 2015, 12:57am

Title: Attribute that depends on children notes
Post by Ralph Alvy on Jan 20th, 2015, 12:57am

Okay, I know this has to be a very fundamental question asked by a newbie. So here goes. I want to get a parent to have a boolean attribute set to true when any of its children has a particular boolean attribute set to true. In this case, I'm using a TB document to track developer changelog entries. These changelog entries have a boolean attribute called DataFile. I check that checkbox whenever a particular entry describes change to code that affects the application's data file. The parent of these entries is the current version number being developed. I'd like the DataFile attribute for that parent to change to true when any of its children have that attribute being true.

So my first stab at at least seeing if I can get an attribute to reflect any of the current note's children having $DataFile=true was this:


Code:
any(children(../$Name),$DataFile=true)


or, because $DataFile is boolean, this:


Code:
any(children(../$Name),$DataFile)


But this way of doing it doesn't get the parent's attribute to update to true when that parent has a child with $DataFile=true. Pointing me to a reference that will help getting syntax and terminology for something like this will be greatly appreciated.

Title: Re: Attribute that depends on children notes
Post by Ralph Alvy on Jan 20th, 2015, 1:13am

I just read a tutorial over at

http://www.eastgate.com/Tinderbox/Tutorials/task.html

and saw this example of a Rule:


Code:
Urgent = any(child,$Urgent);


So I see can use this rule for my version number parents:


Code:
DataFile = any(child,$DataFile);


I guess I can just create a prototype called protoVersionNumber, and add that rule to it.

Title: Re: Attribute that depends on children notes
Post by Mark Anderson on Jan 20th, 2015, 4:58am

In fact though your latter rule works, it does so by legacy support for now-deprecated syntax forms (aside: MB, I have emailed corrections to the cited tutorial page). The rule you want is:

$DataFile = any(children,$DataFile);

The 'corrections' are:
  • References to get/set attribute values use a $ prefix, so we've added one to the left-side attribute that's being set via the code expression. (More on TB code conventions.)
  • any() takes a group designator. 'child' is an old legacy form of the 'children' group designator.
Please don't read this advice as pedantry, given that your solution works. I'm just trying to help you - and others reading here - get started using current conventions and thus save confusion as you move to more complex tasks.

Title: Re: Attribute that depends on children notes
Post by Ralph Alvy on Jan 20th, 2015, 10:31am

Got it. Thanks. Your advice is welcome, as usual.

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.