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
Prototypes and all descendants (Read 16218 times)
Talal
Full Member
*
Offline



Posts: 56

Prototypes and all descendants
Feb 25th, 2008, 12:18pm
 
My hierarchy of an entry of a scholar for whom I am writing a note in TBX is as follows:

Scholar
>Teachers
>AuthoredWorks
  - CommenariesOn
  - AbridgementsOf
>Notes

Each of the children and descendants will have their own children notes, depending on how many teachers, works, etc. the scholar had.

My question: when I now set 'scholar' as a prototype, and then create a note using that prototype, the new note inherits the children -- teachers, authoredWorks, notes -- but not their children -- in this case, CommentariesOn, AbridgementsOf. I do want them included. What do I do?
Back to top
 
« Last Edit: Feb 25th, 2008, 2:03pm by Talal »  
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Prototypes and all descendants
Reply #1 - Feb 25th, 2008, 1:53pm
 
When you assign a prototype to a note, that note gets clones of all the immediate children of the prototype.

In your case, you might have a prototype protoAuthoredWork, of which AuthoredWorks is an instance.  The prototype would bequeath clones of Commentaries and Abridgements.
Back to top
 
 
WWW   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Prototypes and all descendants
Reply #2 - Feb 25th, 2008, 1:54pm
 
It appears PrototypeBequeathsChildren can only pass on 1 'layer' of children, but there is a workaround.

In you prototypes container, make a prototype called p_Scholar with the children Teachers, AuthoredWorks and Notes. Now make a second prototype called p_Works and give it the children CommenariesOn and AbridgementsOf. Now, in your p_Scholar protype's AuthoredWorks child, add this rule:
if ($Prototype(parent)="p_Scholar") {$Prototype="_Works"}

That will result in your desired set of notes.

TIP: the if & else words in an action/rule conditional are case-sensitive. 'If' and 'Else' will cause a silent failure of the rule .... and wasted a fair amount of time here this evening! This fact is undocumented and I'd suggest the manual reflect this fact in forthcoming editions as the case sensitivity is not an obvious fact.

[Sorry Mark B already posted while I was testing this!]
Back to top
 
« Last Edit: Feb 25th, 2008, 1:59pm by Mark Anderson »  

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



Posts: 56

Re: Prototypes and all descendants
Reply #3 - Feb 25th, 2008, 3:01pm
 
MB: In your scenario, I would still have to manually make an AuthoredWorks note, that would then interit the -CommentariesOn and -AbrdigmentsOf children?

MA: I tried your rule, but it didn't seem to do anything. I still have to make the AuthoredWorks note manually, just as in MB's scenario. Of course, I modified your Works to be AuthoredWorks. When creating a new note elsewhere, based upon p_Scholars, are you getting all -CommentariesOn and -AbridgementOf childrenfor AuthoredWorks automatically?

In short, I'm still looking for a way to have *all* descendants be inherited. Just for my understanding, is there a reason why all the descendants are not inherited, as opposed to just the children?
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Prototypes and all descendants
Reply #4 - Feb 25th, 2008, 3:40pm
 
Well, you're probably making a minor syntax mistake somewhere - remember that in many cases user code syntax errors fail silently in TB, it's up to the user to figure out how/why. Anyway, to assuage your doubt that what you want is possible, please see the demo I just made. Download "multilevel_children.tbx.zip" from this page: http://homepage.mac.com/mwra/FileSharing5.html.

The demo proves the basic idea, albeit with a workaround of linked prototypes. However, it might help you with getting the basics running. Once you're happy with the basics, feel free to embellish and add other code. I hope this helps!
Back to top
 
 

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



Posts: 56

Re: Prototypes and all descendants
Reply #5 - Feb 25th, 2008, 4:23pm
 
MA: Thank you so much. I don't know what I was doing wrong the first time, but it is now working, and your model helped. Much appreciated!
Back to top
 
 
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Prototypes and all descendants
Reply #6 - Feb 25th, 2008, 6:38pm
 
The Scholar's prototype  bequeaths the immediate children, and sets their prototypes.

Setting the prototypes of the children now clones the grandchildren.
Back to top
 
 
WWW   IP Logged
Talal
Full Member
*
Offline



Posts: 56

Re: Prototypes and all descendants
Reply #7 - Feb 25th, 2008, 7:01pm
 
Mark Bernstein wrote on Feb 25th, 2008, 6:38pm:
The Scholar's prototype  bequeaths the immediate children, and sets their prototypes.

Setting the prototypes of the children now clones the grandchildren.


Just so I am clear: "now" meaning as of 4.1, or "now" in your to-be-released version? In other words, as of now, do I still have to do the work-around that Mark A kindly provided, or will the setting of the children's prototypes suffice?...because it didn't work for me when I tried it before.
Back to top
 
 
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Prototypes and all descendants
Reply #8 - Feb 26th, 2008, 3:29pm
 
When I wrote that

Quote:
The Scholar's prototype  bequeaths the immediate children, and sets their prototypes.

Setting the prototypes of the children now clones the grandchildren.


I meant that there's a sequence of events.  First, the Scholar prototype bequeaths immediate children and sets the prototypes of each child.

Then, setting the prototype of the children will cause the prototypes of the newly-made child notes to bequeath clones of their children.  All this applies to Tinderbox 4.1
Back to top
 
 
WWW   IP Logged
Pages: 1
Send Topic Print