Hi,
I am not sure if I am doing something wrong or if there is some sort of race condition with tiddler actions being evaluated but here is my example:
\define currentStateTid() $:/temp/$(dbname)$DBedit
<$set name="dbname" value="some_database">
<$button>
<$action-createtiddler $basetitle=<<dbname>> $savetitle=<<currentStateTid>>/>
<$wikify name="state_tiddler_content" text="<$view tiddler=<<currentStateTid>> />">
<$fieldmangler tiddler=<<state_tiddler_content>>>
<$action-sendmessage $message="tm-add-tag" $param={{!!current_tag}}/>
</$fieldmangler>
</$wikify>
{{$:/core/images/new-button}}</$button>
</$set>
When you paste this into a new tiddler and add a field "current_tag" with something in it you will end up with a tiddler with a plus button.
Clicking the button will add a new tiddler with the name referencing the variable dbname = "some_database". If that already exists, a number is added/incremented accordingly.
So far, so good.
I want to then add a tag to the created tiddler using the contents of the "current_tag" field. However, since I don't know what the created tiddlers name is beforehand, I am referencing the content of the $savetitle from the previous $action-createtiddler. When you do this though, it seems to add the tag to the tiddler that was in <<state_tiddler>> *previously* ... as if the tm-add-tag message gets processed before the $action-createtiddler can set the <<state_tiddler>> to the new value.
I have thought of using the tags option in $action-createtiddler so I don't have to know the resulting tiddler name but the tag in current_tag has spaces and needs to be appended to a bunch of other tags coming from some other template and dealing with passing around the required "[[tag with spaces]]" has been proving painful. The closest that I have gotten is to add a bunch of tags with each of them the words in "current_tag" eventhough the [[]] characters are being passed.
Is this a bug or am I doing something wrong?
/Mike