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 2 
Send Topic Print
Export an agents and an container's children (Read 18842 times)
Sebastian Stephenson
Full Member
*
Offline



Posts: 100

Export an agents and an container's children
Sep 04th, 2010, 11:59am
 
Hi I am trying to create a template that allows me to export a agents children (and other descendants). I am also at the same time trying to export a list of a containers children in the same note

there would be two lists on this single export one with the descendants of the agent.The other would be a a list of descendants from a container

This sound easy but I have been trying to get it to work for a while now

Note that I am using tinderbox 4.6.2. thanks
Back to top
 
 
Sebastian Stephenson sebey9   IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Export an agents and an container's children
Reply #1 - Sep 4th, 2010, 4:07pm
 
^children is your friend Smiley

^children exports all the immediate children of a note.  Often, these might have children, too -- and their export template can in turn include those children.
Back to top
 
« Last Edit: Sep 4th, 2010, 4:09pm by Mark Bernstein »  
WWW   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Export an agents and an container's children
Reply #2 - Sep 4th, 2010, 9:20pm
 
@Sebastian, in v4.6.2 for ^children^ read ^justChildren^ and for ^descendants^ read ^children^. In each case the former replaced the latter in v5.0.0+.

You can't export descendants of agents only children. Why? An agent only contains aliases and aliases never have children- regardless of whether their original note does.  If you truly are expecting to descendants via an agent you need to re-thing your export.

In simple terms you want one master HTML page template which has 2 includes - one for the agent and one for container. In both cases the include call recursing folders. It is that simple in concept.  I appreciate that recursion isn't obvious to everyone.  If you don't know how to achieve what I've described and want more detailed help, please post a link to a specimen TBX that can be used as a reference file.

Later: as you're on an old version, you'll want to use this version of aTbRef which is based on v4.6.0 and lists per version differences up to v4.7.1. Important note: use old aTbRefs as you find them and note any corrections for yourself as I no longer update the pages - only the current version [sic] is updated.
Back to top
 
« Last Edit: Sep 6th, 2010, 11:16am by Mark Anderson »  

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



Posts: 100

Re: Export an agents and an container's children
Reply #3 - Sep 19th, 2010, 12:07pm
 
Hey Mark Anderson thanks for reply, Sorry about mylate reply. I decided not to use an agent and use a container instead.

Here is the specimen file

files.me.com/sebey/c8h76e

Note that this is a blank file with the structure in it with no export code. if there is anything you think needs to be added or need help understanding please don't be afraid to reply it will not take as long  Wink
Back to top
 
 
Sebastian Stephenson sebey9   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Export an agents and an container's children
Reply #4 - Sep 19th, 2010, 4:19pm
 
@Sebastian, thanks.  The file makes sense except ideally can you add a note in it explaining what you want to happen? Having that saves chopping back an forth to a forum thread and then trying to figure the real requirement from our online discussion. That way, the task is available to be read inside TB. Are we truly exporting immediate children - or all descendants? If the latter, are all indented/listed together?Sorry, to sound pedantic but whilst obvious in your mind's eye, it's less obvious to someone trying to write the template for you.

If you supply notes with no $Text, I'll take that literally as you explicitly not wanting anything but note titles to be exported. If you do want to export text, ideally put a some text in the notes intended for export. If accents and such are important make such the export text includes likely problems.  This saves doing the template dev task many times over: note, then notes with text, then notes with non-ASCII text, etc. Enlightened self-interest!


Back to top
 
 

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



Posts: 100

Re: Export an agents and an container's children
Reply #5 - Sep 19th, 2010, 4:53pm
 
Hey mark thank you so much for the help

here is a second specimen file with more $text and documentation of what I am looking for
files.me.com/sebey/0ul7kg

I will also post what the documentation as well. There are two kinds of documentation

Export Documentation
Quote:
I wish to have notes that have selected to go to the container("a contianer") to appear
           here
           here
           some $text form "here" no. 2
           here
                 "sub here"
                 "sub here"

and if nesscarry to have "sub notes" appear below if there. the same would go for $text if there

then I would like another container and have its information taken from (which sub notes and $text there if required). I would like them displayed

           here
           here
           here




Visual Outline of Export
Quote:
from contianer("a container")
=================

     note
     note
     $text form note no.2
     note
           sub note
           sub note
           sub note

From container("a second container")
=====================

     note form second container
     note form second container copy
     $text form note form second container copy
     note form second container copy 1
           sub note from second container copy 1
Back to top
 
 
Sebastian Stephenson sebey9   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Export an agents and an container's children
Reply #6 - Sep 19th, 2010, 6:02pm
 
I sort of follow, but the instructions don't match the data (you refer to notes that don't exist in the example). To help you I need to be able to understand exactly which source note goes where in the export and why. I also need to understand if a note is included because it is a child, because of its name, because it's the Nth in a sequence or whatever. A template can't export a 'selection' - unless using Nakakoji view and then there are different limits as to what you can do. You could use an agent to define the notes you'd like 'selected' for export though it might not be possible to export them in their original hierarchy.

I understand you wish the first container "a container" to export other parts of the TBX but I've no description of which notes they are. For instance, "$text form note no.2". You don't have a note "no.2".  So do you need text from the second note? Only the second note? second note from which container - or from every container? Etc....

My hunch is you're trying to export some form of structured TB notes into a slightly differently arranged text form.  Perhaps, unintentionally, your example is too abstract - in other words it's too general to show the structure of both the source and output data.

Stepping back to the beginning, in what format are we exporting? Text, HTML, some other mark-up?

I'm sorry for all the questions. I'm aware you're trying to do something that, from where you sit, is a simple and obvious task - but the logic is not clear. Why not put some example data in your TBX - so we can see the sort of thing you're attempting and an example (made manually) of the desired text/HTMl/whatever export?

As a general building block, the container you'll use for export can 'find' its data one of 2 ways:
  • make the $Text of the container an ^include()^ command and simple export the contents of the container's $Text.
  • Have no $Text in the container and put the ^include()^ in the template used to export the container.
Both lead to the same end - the difference is mainly stylistic though if we're handling non-ASCII text one method might prove more robust than the other.
Back to top
 
« Last Edit: Oct 22nd, 2010, 6:58pm by Mark Anderson »  

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



Posts: 100

Re: Export an agents and an container's children
Reply #7 - Oct 22nd, 2010, 11:22am
 
Hi mark

I have updated the file in hope that it is much clearer as I believe there was information in the previous flie that was not relevant to the problem

files.me.com/sebey/p1drbn

Quote:
Stepping back to the beginning, in what format are we exporting? Text, HTML, some other mark-up?

It is text we are trying to export

Quote:
an example (made manually) of the desired text/HTMl/whatever export?

This has been added

Sorry about a month late reply but been busy so thank you hopefully you can remember the problem

Again thank you so much for your attention
Back to top
 
 
Sebastian Stephenson sebey9   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Export an agents and an container's children
Reply #8 - Oct 22nd, 2010, 7:09pm
 
So in either container's case a note is to be exported if it meets one, or both, of these conditions:
  • It has text
  • It has children
In addition, the hierarchy exports until there are are no more children. Correct?

I ask, as if you only want one level of children exported, then we need to clarify that in the export code. This is because the obvious approach for your scenario is an envelope-letter approach - as discussed regularly on the forum. However, such a solution will drill down until there are no more children. That would not be satisfactory if you only want children of the container exported but not grandchildren.
Back to top
 
 

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



Posts: 100

Re: Export an agents and an container's children
Reply #9 - Oct 24th, 2010, 5:15am
 
The containers will export if there any of these:

  • children
  • children with $text
  • children with grandchildren


and possibly mixtures of both(i.e. children with grandchildren and $text in the child and possibly grandchildren)

thanks
Back to top
 
 
Sebastian Stephenson sebey9   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Export an agents and an container's children
Reply #10 - Oct 24th, 2010, 5:26am
 
So we don't export anything more than 3 levels deep, i.e. we don't export great-grandchildren. I think what you're intending is a recursion where we keep on including all children's children until there are no more. True? If so is each level of descent to be a nested bulleted list - i.e. the list indents each time we drop a level of $OutlineDepth?
Back to top
 
 

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



Posts: 100

Re: Export an agents and an container's children
Reply #11 - Oct 24th, 2010, 6:25am
 
yes. If you can do that, that would be fantastic!
Back to top
 
 
Sebastian Stephenson sebey9   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Export an agents and an container's children
Reply #12 - Oct 24th, 2010, 7:13am
 
No  problem, a straight recursion - including children until there are no more - is actually simpler. I'll work on your earlier demo. thanks.
Back to top
 
 

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

User - not staff!

Posts: 5689
Southsea, UK
Re: Export an agents and an container's children
Reply #13 - Oct 24th, 2010, 6:06pm
 
OK, using your specimen files...

1. Set "a container" to use the built-in HTML export template "HTML page"

2. Set $Text of "a container" to:
Code:
Today my tasks are
=============
^include("/data","/Templates/tasks")^

Checklist
======
^include("/a second container","/Templates/tasks")^
 


3. Make a root-level container "Templates" with the $OnAdd of : $IsTemplate = true;

4. Inside "Templates" add a note 'tasks" and give it this code:
Code:
<li>^title^
^if(Text)^<br>^text^^endIf^
^if(ChildCount)^<ul>^children("/Templates/tasks")^</ul>
</li>
 



5. Export "a container' to HTML and you now get the export described in your example.

Note: the assumption, based on the example supplied is that any $Text will be short and certainly not more than one paragraph. If longer, you may need to experiment with adding more control layout to the $Text data, but that's probably a new topic of its own.

[Post edit: removed unneeded ^indent^ from step #4 & added end note]
Back to top
 
« Last Edit: Oct 25th, 2010, 2:51am by Mark Anderson »  

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



Posts: 100

Re: Export an agents and an container's children
Reply #14 - Oct 25th, 2010, 7:09am
 
Mark this is really great and thank you very much really appreciate this  but I am sorry I need it in text format. It works in HTML but not in text.


Thank you so much mark
Back to top
 
 
Sebastian Stephenson sebey9   IP Logged
Pages: 1 2 
Send Topic Print