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
A simple action to Promote the children (Read 1400 times)
Desalegn
Full Member
*
Offline



Posts: 78
Norway
A simple action to Promote the children
Oct 12th, 2016, 7:35am
 
Can sb tell me how put an addon to promote the children of a container?

I have a couple of containers.  I want to flatten them out. I can manually fallen them out by Shift+TAB: but, that will be tedious in the long run.

I tried to put an addon on a Prototype like this:

Code:
$Container=$Path(parent) 



doesn't seem to work. Any easy way?
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: A simple action to Promote the children
Reply #1 - Oct 12th, 2016, 8:22am
 
The $OnAdd only fires when a note is added to the container (using that prototype). I suggest 2 methods - in no particular order.

1. Use a Stamp
Here we select the items to promote and the stamp code is:

  $Container=$Container(parent);

However, in most cases using Shift-Tab on the selection is as easy. So…

2. Agent. Use a query to find the relevant notes. It is important to remember that the agent action is applied to the alias inside that agent but that we want the effect to apply to the original note of the alias. Therefore, the action is:

  $Container(original) = $Container(parent(original));

Note that 'original' and 'parent' aren't in quotes in the code to make clear they are designators and not literal string value as in a title or path value.
Back to top
 
 

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

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: A simple action to Promote the children
Reply #2 - Oct 12th, 2016, 11:27am
 
$Container=$Path(parent) would not, in any case, move the note, since this sets the container to be the note's parent.  You probably mean $Container=$Path(grandparent)

If you make a note with the onAdd action $Container=$Path(grandparent), then notes added to that container will “bounce” out to become the container’s sibling.  

If you made a rule $Container=$Path(grandparent) (don't do this!), then the note would continuously move itself to the top level.  Fortunately, Tinderbox happens to recognize that, once the note gets to the top level, there is no grandparent container and Tinderbox does the right thing. Phew!


Back to top
 
 
WWW   IP Logged
Desalegn
Full Member
*
Offline



Posts: 78
Norway
Re: A simple action to Promote the children
Reply #3 - Oct 12th, 2016, 2:02pm
 

Quote:
If you make a note with the onAdd action $Container=$Path(grandparent), then notes added to that container will “bounce” out to become the container’s sibling.
worked beautifully.

I need to look closely to  Mark Anderson's Agent: seems the long term solution; as I am going to dump many text files into TB.

Great! Thank you guys.
Back to top
 
« Last Edit: Oct 12th, 2016, 2:07pm by Desalegn »  
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: A simple action to Promote the children
Reply #4 - Oct 12th, 2016, 4:20pm
 
Quote:
as I am going to dump many text files into TB


So, I'd test the action part of the agent in a small test fill so you're confident with the result. Then, for each of your real-world sets of data you just need to set the correct agent query, then apply the code. Again, for the first actual run, I'd make the agent with no action, check the right notes are found and only then add the action code. In the latter case, if you have automatic agent updates off (default is on - see File menu) then you'll need to refresh the agent via the File menu to ensure the new action code is run.

Good luck with the imports. I do this sort of thing a lot and it works very well. Don't overlook the 'spreadsheet' type import as this can auto-populate system/user attribute for you saving you digging it out of the imported text - see more.
Back to top
 
 

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



Posts: 78
Norway
Re: A simple action to Promote the children
Reply #5 - Oct 22nd, 2016, 1:14pm
 
Quote:
$Container(original) = $Container(parent(original));


This very useful agent. I am now able to easily archive away the notes I don't need any more.

Code:
$Container(original) = $Path("archive"); 



Thank you.
Back to top
 
« Last Edit: Oct 22nd, 2016, 1:16pm by Desalegn »  
  IP Logged
Pages: 1
Send Topic Print