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 >> How to designate "this note and its descendants"?
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1364744276

Message started by Rob Forsyth on Mar 31st, 2013, 11:37am

Title: How to designate "this note and its descendants"?
Post by Rob Forsyth on Mar 31st, 2013, 11:37am

I'm using a rule in a note prototype to define

$TotalDuration=sum(descendants,$DurationInMonths)

where $DurationInMonths is a hopefully self-explanatory Key Attribute.

I'd prefer $TotalDuration to be the sum of $DurationInMonths of this note plus any descendants (so that for notes with no children, $TotalDuration = $DurationInMonths)

Although in other contexts I see "section" is defined as "this note + any children" this doesn't seem to be available as a group designator. Am I obliged to use a conditional rule?

Thanks

Rob


Title: Re: How to designate "this note and its descendants"?
Post by Mark Anderson on Mar 31st, 2013, 11:57am


Quote:
I'd prefer $TotalDuration to be the sum of $DurationInMonths of this note plus any descendants (so that for notes with no children, $TotalDuration = $DurationInMonths)

As stated that implies this is the case even for notes with descendants so no conditional is required. You $Rule should be:

$TotalDuration=$DurationInMonths + sum(descendants,$DurationInMonths)

If you want to use the current note only where there are NO descendants then you do need a conditional rule:

if($DescendantCount){$TotalDuration=$DurationInMonths;}else{$TotalDuration=sum(descendants,$DurationInMonths)}

Title: Re: How to designate "this note and its descendants"?
Post by Rob Forsyth on Mar 31st, 2013, 12:01pm

Thanks Mark!

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.