Tinderbox Forum

Cannot move note to a $Container using a KA


I have a KA with the Name $MyPath, and have the path “/Task Management/erledigt/KW40 (1.10.-7.10.18)/2018-10-2” stored in it.

Now I have an agent, that should move a note there with the action code:


but that does not work.

I tried it using $MyPath(that) with only $MyPath assigned to the agent, as well as $MyPath assigned to all the notes, that should be moved. TB only moves the notes to “/Task Management/erledigt”, which is two levels to high.
When I make the action code like this:

$Container(original)="/Task Management/erledigt/KW40 (1.10.-7.10.18)/2018-10-2",

it works. But the $MyPath changes from day to day, so it should be variable…

Where is my mistake?

This works for me

var mypath("/Target"); $Container(original)=mypath;

Doesn’t work … unfortunately.

My code now:

$NameStrike=true;var mypath(collect(lastChild(lastChild(“erledigt”)),$Path));$Container(original)=mypath;$Text(that)=mypath;

As you can see in the screenshot, the path is correct, but the agent again moves the note into “/Task Management/erledigt”.

Edit: When I change the code to:

$NameStrike=true;var mypath(collect(lastChild(lastChild(“Templates”)),$Path));$Container(original)=mypath;$Text(that)=mypath;

it is moved correctly to the lastChild of the lastChild of “/Templates”. But that’s not the right place :smiley:

Possible errors:

  • $mypath and $MyPath are different, discrete, attributes when defined in Tinderbox. Attribute names are cases sensitive. You don’t have to use ‘CamelCase’ naming, but as that is tab’s own internal style, I tend to stick with it when naming my own user attributes, i.e. I’d use $MyPath over $mypath for clarity of purpose.
  • $Container(original)=mypath. Is ‘mypath’ a string literal or an attribute? Your syntax is forcing Tinderbox to guess whether you meant $Container(original)="mypath" or $Container(original)=$mypath … or something else, e.g. $Container(original)=$MyPath.
  • Omitting the ‘$’ from an attribute reference in action code is allowed for legacy support reasons as back in 2001 the prefix wasn’t yet used (as export/action code was much less complex than it is today).

I tested your original scenario from the opening post, using an agent, with the path data you supplied and it works, as shown:

In my file, ‘agent1’ is doing the moving. I created 2 specimen target notes ‘xx’ and ‘yy’ in container /bin and set a $MyPath value. In note ‘yy’ I was testing an edge case that the issue was the parentheses (i.e. brackets) in the container named ‘KW40 (1.10.-7.10.18)’ and used square brackets instead. As it happens, the parentheses weren’t a problem.

So, I’d guess the best thing is to revisit your action code syntax for possible errors before trying to fix a problem that may not be there.

I found the error:

On my system, the culprit are the parentheses! With the square brackets (or without any), it works. By the way, not to mix the things up:

In my first example I used a KA, using also the $ and CamelCase,
in the second example, I used a local variable (following @PaulWalters’ advice), and when I am getting things right, the notation with the $ doesn’t work there, or does it? I tried every combination, and it didn’t…

So the interesting question for me is now: Why do the parentheses work on @mwra’s computer but not on mine?

Ok, I found another interesting thing:
With the parentheses, the string value of MyPath is:

“/Task Management/erledigt/KW40 (1.10.-7.10.18)/2018-10-4” whereas with the brackets it is
/Task Management/erledigt/KW40 [1.10.-7.10.18]/2018-10-4, that is, without the double quotes.

Any ideas?

OK, here’s my file (using v7.5.6 b335, on UK layout OS 10.13.6): container-move.tbx (58.1 KB)

If you drag notes ‘xx’ and ‘yy’ back to be children of ‘bin’ the agent finds and moves them.

For avoidance of doubt about terminology, in my British English () are ‘brackets’ (less commonly ‘parentheses’), [] are ‘square brackets’ and {} are ‘curly brackets’.

In KA, QuickStamp and get info neither $MyPath value shows enclosing quotes. You could try removing them - a String-type attribute should not have enclosing quotes when seen in KA. I wonder if you included them by mistake when copying the value from a quoted string literal?

I added a rule to xx and yy. Now you can see, what I mean!
container-move.tbx (58.5 KB)

OK, this is collect() surfacing the path ‘bad character’ problem (quotes, slashes, parentheses in path). It’s not a bug per se as the limitation on characters in the path as handled in action code is not documented. There issue is essentially know but i’m not sure there’s an accepted solution as yet. In part this is probably as it may require delicate surgery to some low level bit of the apps code. It’s another of these issues where only a few people likely hit the problem but those who do hit it all the time.

:joy:… nice! It took me just a few hours to figure this out, but I’m quite sure, I won’t forget!!! Something like this on top of TBs learning curve… that’s exponential learning

Ok… I use square brackets now

1 Like

Ok… in my german english, I’m always confused about the different terminologies: I thought, these () were parentheses, [] these brackets and {} these braces. But this seems to be american then? I will try to stick to your British English style in the forum…

No problem. I’d hesitate to call anything ‘correct’ as we’re an international crowd here and English varies a fair bit by locale. I simply clarified my usage in case the meaning might be interpreted differently.

These, ( and ), are the parenthetical characters we need to worry about.

1 Like