Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
Attribute that depends on children notes (Read 1913 times)
Ralph Alvy
Full Member
*
Offline



Posts: 85
Santa Monica
Attribute that depends on children notes
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.
Back to top
 
« Last Edit: Jan 20th, 2015, 12:58am by Ralph Alvy »  
  IP Logged
Ralph Alvy
Full Member
*
Offline



Posts: 85
Santa Monica
Re: Attribute that depends on children notes
Reply #1 - 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.
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Attribute that depends on children notes
Reply #2 - 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.
Back to top
 
« Last Edit: Jan 20th, 2015, 4:59am by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Ralph Alvy
Full Member
*
Offline



Posts: 85
Santa Monica
Re: Attribute that depends on children notes
Reply #3 - Jan 20th, 2015, 10:31am
 
Got it. Thanks. Your advice is welcome, as usual.
Back to top
 
 
  IP Logged
Pages: 1
Send Topic Print