Mal,

 Give a try to below code

\define newTitle() myTiddler-{{{[[0]count[]add[$(inc)$]addprefix[0000]split
[]last[3]join[]]}}} 


\define newTiddler(n:0)
<$set name="inc" value={{{ [<__n__>add[1]] }}}>
<$wikify name="myTitle" text="<<newTitle>>" >
<$list filter="[<myTitle>] +[!has[title]]" 
emptyMessage=""" <$macrocall $name="newTiddler" n=<<inc>> /> """>
<$action-createtiddler $basetitle=<<myTitle>> tags="myTag" />
</$list>
</$wikify>
</$set>
\end

<$button actions=<<newTiddler>>>
Create a new tiddler
</$button>



Create 10 tiddlers, and then randomly delete some of them and then again 
click on the button!
It detects if previous ones are deleted and create with first free sequence 
number.


--Mohammad




On Saturday, February 23, 2019 at 6:54:50 AM UTC+3:30, Mal wrote:
>
> Hi Mohammad,
>
> An alternative approach - requires all numbers to be zero padded to fixed 
> number of digits.  Assuming 3 digits:
>
> \define newTitle() myTiddler-{{{[tag[myTag]removeprefix[myTiddler-]sort[]
> last[1]add[1]addprefix[0000]split[]last[3]join[]]}}}
> \define newTiddler()
> <$wikify name="myTitle" text="<<newTitle>>" >
> <$action-createtiddler $basetitle=<<myTitle>> tags="myTag" /> 
> </$wikify>
> \end
>
>
> This should always increment the title with the largest number and is not 
> affected by deleting other tiddlers.
>
> Regards,
>
> Mal
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/33dbb852-df3f-430c-9f75-f79ea5d402f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to