Lurker struggling with $action-setfield syntax

Hello,
A new member here (but I have read a lot over the last few years). Usually I manage to solve any TW problems with lots of searching, but can’t seem to overcome this one.
I want to get user input to create a new tiddler with the title “2024.09.11.Wed” or whatever date they want. This will be text and not a date format. The following code needs to set a tag to “2024.09”:

tags={{{ [[{{!!_long-date}}]split[]first[3]join[]] }}}/>

which won’t work. I adapted it from this code:

{{{ [[This is my string]split[]first[3]join[]] }}}

which does work as it is. Here is the full tiddler

\define temp() $:/temp/input/$(currentTiddler)$

Date eg 2024.08.18.Sun:<$edit-text tiddler=<<temp>> field="_long-date"/>
<$button>
  <$view tiddler=<<temp>>>New Entry</$view> 
  <$tiddler tiddler=<<temp>>>
  <$action-setfield $tiddler={{!!_long-date}} entry_date={{!!_long-date}} tags={{{ [[{{!!_long-date}}]split[]first[3]join[]] }}}/>
   </$tiddler>
   <$action-deletetiddler $tiddler=<<temp>> />
</$button>

Any thoughts or advice would be most appreciated!
Perisher.

Hi @Perisher, and welcome to (being active on) the forum.

I don’t see, anywhere in your post, what the field _long-date looks like. But if it’s like 2024.08.18.Sun (which your code seems to imply?)… then to get something like 2024.08 as a result you need to split with periods, and get the first 2, something like so:

{{{ [{!!_long-date}split[.]first[2]join[.]] }}}

This is untested, but note at least this correction to your syntax: you had extra brackets. Within a filter expression, you don’t double your curly brackets. Rule of thumb is you never get more than 2 layers deep into brackets, within a filter expression.

Let us know whether this is what you need.

Wow, @Springer, I can’t thank you enough. This has been bugging me for about three days. Now that you show the correct code it seems quite obvious, but hindsight and all that…

Yes, you are correct.

I read a post on reddit.com/r/TiddlyWiki5/ titled “Is TiddlyWiki is too hard? (rant)”. It’s still new and easy to find. I think TW is wonderful and have made very some useful wikis for my personal and business use. But as I am not creating things every day there is a grain of truth in that post for me. But thanks to you I now have a working wiki.
ATVB!
Perisher