New Tiddler button with title from another tiddler's field

64 views
Skip to first unread message

Alex Hough

unread,
Jan 7, 2016, 6:55:19 AM1/7/16
to TiddlyWiki
Dear All,

I have this button..

<$button message="tm-new-tiddler" param={{InvoiceTemplate!!invoice-title}}>New Invoice</$button>


InvoiceTemplate!!invoice-title contains {{!!customer}}, {{!!period-name}}


I want to generate a new invoice with the name of the customer and period

I can transclude from the Tiddler itself, like this

<$button message="tm-new-tiddler" param={{!!invoice-title}}>New Invoice</$button>

but what I get is "{{!!customer}}, {{!!period-name}}" as the title when I try to get the field from the InvoiceTemplate field

What am I doing wrong?

Alex

Tobias Beer

unread,
Jan 7, 2016, 7:58:07 AM1/7/16
to tiddl...@googlegroups.com, Tiddl...@googlegroups.com
Hi Alex,

No idea how to do it with the core but
you can use tobibeer/make with tobibeer/setvars to achieve the desired result:

<$setvars
_make="[[]make[{{!!customer}}, {{!!period-name}}]]"
new-title="[make[][][]]">
<$button message="tm-new-tiddler" param=<<new-title>>>New Invoice</$button>
</$setvars>

Demystified:
  • [make[][][]]
    • evaluate the attribute _make as a filter and...
      • not specifying an item range, so taking all titles ...well there is just one bering 
      • not specifying any empty value ...because it's never going to be empty
      • joining all items to a string ...not using any separator
  • [[]make[{{!!customer}}, {{!!period-name}}]]
    • create a unique title based on the customer and period-name fields of the current tiddler
You can also use the make filter to create a unique, zero-padded invoice number that is unique among all invoices and simply incremented with every new invoice.

Best wishes,

Tobias. 

Tobias Beer

unread,
Jan 7, 2016, 10:36:40 AM1/7/16
to TiddlyWiki, Tiddl...@googlegroups.com
Hi Alex,
 
No idea how to do it with the core but
you can use tobibeer/make with tobibeer/setvars to achieve the desired result:

You may be interested in this update for tobibeer/make (version 0.6.0).

Best wishes,

Tobias. 
Reply all
Reply to author
Forward
0 new messages