How to exchange the space separator before the number of new tiddler

Hello TW-Community,

I have this (simplified) procedure what is creating new Tiddlers named and tagged by the parameter.

\procedure new-entry(selector)

<$button>
<$action-createtiddler
  $basetitle=<<selector>>
  tags=<<selector>> >
  <$action-navigate $to=<<createTiddler-title>>/>
</$action-createtiddler>

  {{$:/core/images/plus-button}} 
  <<selector>>
</$button>

\end

This is working fine but I don’t want to have them as
Name 1
Name 2
Name 3

I want to have a separator like “_” or defined by another separator to call <<new-entry “Name” “#”>>
what will produce
Name#1
Name#2
Name#3
after checking the documentation in https://tiddlywiki.com/#ActionCreateTiddlerWidget and https://tiddlywiki.com/#WidgetMessage%3A%20tm-rename-tiddler I have no idea how to do it.

Any help is welcome
Stefan

Have a closer look at the unusedtitle macro

Hi @pmario,

thank you, I was not aware of such a possibility.
But it is failing if I am using parameters in a procedure.

\procedure new-entry(selector, sep)

<$button>
<$action-createtiddler $basetitle=<<unusedtitle baseName:"$selector$" separator:"$sep$" template:"$basename$$separator$$count:2$">>/>
  <$action-navigate $to=<<createTiddler-title>>/>
</$action-createtiddler>


  {{$:/core/images/plus-button}} 
  <<selector>>
</$button>

\end

Stefan

If baseName and separator are dynamic you will need the wikify widget. The macro parameters can not be dynamic without a macrocall. Which is not possible in your case.

Having code inside the button body, will cause problems with variable evaluation. So an action parameter is needed.

Try this: code tested

\procedure new-entry(selector, sep)

  \procedure new-tiddler()
    <$wikify name="title" text=`<<unusedtitle baseName:"$(selector)$" separator:"$(sep)$" template:"$basename$$separator$$count:2$">>`>
    <$action-createtiddler $basetitle=<<title>>>
      <$action-navigate $to=<<createTiddler-title>>/>
    </$action-createtiddler>
  </$wikify>
  \end new-tiddler

<$button actions=<<new-tiddler>> >
{{$:/core/images/plus-button}} <<selector>>
</$button>
\end

<<new-entry "asdf ddd" "-">>

See: https://tiddlywiki.com/#Substituted%20Attribute%20Values

Hi @pmario ,

thank you for your explanation.

I tried to add the startCount value as in the Example TiddlyWiki Example

    <$wikify name="title" text=`<<unusedtitle baseName:"$(selector)$" separator:"$(sep)$" startCount:"01" template:"$basename$$separator$$startCount$$count:2$" >>`>

but it is not accepted also not if I try

    <$wikify name="title" text=`<<unusedtitle baseName:"$(selector)$" separator:"$(sep)$" startCount:"01" template:"$basename$$separator$$count:2$" >>`>

or

    <$wikify name="title" text=`<<unusedtitle baseName:"$(selector)$" separator:"$(sep)$"  template:"$basename$$separator$$startCount:01$$count:2$" >>`>

Is there another topic I have to take care?

Stefen

1 Like

This works. startCount is a macro parameter. It can not be used in the template. See the docs.

<$wikify name="title" text=`<<unusedtitle baseName:"$(selector)$" startCount:"1" separator:"$(sep)$" template:"$basename$$separator$$count:2$">>`>

Hi @pmario ,

Thank you for the fast reply,
I though exactly like you (in my first try) but if I use it is still starting with “00”.

\procedure new-entry(selector, sep)

  \procedure new-tiddler()
    <$wikify name="title" text=`<<unusedtitle baseName:"$(selector)$" startCount:"01" separator:"$(sep)$" template:"$basename$separator$count:2$">>`>
    <$action-createtiddler $basetitle=<<title>> tags=<<selector>> >
      <$action-navigate $to=<<createTiddler-title>>/>
    </$action-createtiddler>
  </$wikify>
  \end new-tiddler

<$button actions=<<new-tiddler>> >
<$text>[tag[<<selector>>]count[]]</$text>
{{$:/core/images/plus-button}} <<selector>>
</$button>
\end

Stefan

How does your “separator” look like?

Hi @pmario ,

it is "/"

Stefan

Your template string is not valid. Please use my code from How to exchange the space separator before the number of new tiddler - #5 by pmario – It should work as expected if you add startCount:"02" there

Hi @pmario ,

to make sure that there was no fault by transfering I copied it again :slight_smile:
and added startCount:“02”.
Everything works well and as expected, exept starting is still “00”. :thinking:

code-body: yes
tags: $:/tags/Global
title: tryout/new_entry

\procedure new-entry(selector, sep)

  \procedure new-tiddler()
    <$wikify name="title" text=`<<unusedtitle baseName:"$(selector)$" separator:"$(sep)$" startCount:"02" template:"$basename$$separator$$count:2$">>`>
    <$action-createtiddler $basetitle=<<title>>>
      <$action-navigate $to=<<createTiddler-title>>/>
    </$action-createtiddler>
  </$wikify>
  \end new-tiddler

<$button actions=<<new-tiddler>> >
{{$:/core/images/plus-button}} <<selector>>
</$button>
\end

I added this in an empty New Tidler for testing

<<new-entry "Department" "/">>

I tried also to add tags=<<selector>> into the <$action-createtiddler as in my 1st post but it seems to be not possible within a wikify .

Stefan

Did you test it at tiddlywiki.com?

I tried it now at tiddlywiki.com.
And here it is working as expected?
The Version I am working with is TiddlyWiki version 5.3.5.

Should I update to 5.3.6?

Yes. startCount is available since v5.3.6 – That’s why it did not work with your version.

1 Like

@pmario ,

I am so sorry about this missunderstanding :cry:

THANK YOU SO MUCH FOR YOUR SUPPORT