Append a string containing space to a field

65 views
Skip to first unread message

damien Dupont

unread,
Aug 19, 2019, 12:13:27 PM8/19/19
to TiddlyWiki
Hello everyone,

I recently discovered this fabulous tool (Tiddly wiki) and I'm trying to customize it to my needs.
However I need some help from Tiddly experts.

I would like to store in the field of a tiddler the content of a table row. In my tiddler, I put an edit-text field and a button to add a new word to the field (and then to the row).

To do this, I decided to separate each word composing my row with "!". For example the field "myrow" will contains : "firstelement!secondelement!thirdelement"

To add to this field a new word, I use a filter to insert it. It works but I have a problem with element with space (ex : "fourth element") -> it will be cut where the space is.

Here is the filter I use to rewrite the "myrow" field :

[all[current]get[myrow]split[!]append[fourth element]join[!]]

Do you have an idea how to explain to tiddly wiki to consider "fourth element" as 1 string only ? or do you have another solution ?

I'm not so familiar with the filter syntax, if you have ressources to help me, it could be great also.

Thanks

BurningTreeC

unread,
Aug 19, 2019, 12:24:51 PM8/19/19
to TiddlyWiki
Hi Damien,

maybe this trick works for you:

[all[current]get[myrow]split[!]append[fourth_element]join[!]split[_]join[ ]]


damien Dupont

unread,
Aug 19, 2019, 12:34:24 PM8/19/19
to TiddlyWiki
Thanks for your help but in fact, in my case "fourth element" represents a variable that contains an input of the user (through the edit-text) and that can contains spaces inside.

BurningTreeC

unread,
Aug 19, 2019, 12:45:16 PM8/19/19
to TiddlyWiki
Hi again,

you don't need a filter for this, see this example-button:

\define get-concatenated-value()
$
(myrow)$!$(userInput)$
\end

<$button>
<$set name="myrow" value={{!!myrow}}>
<$set name="userInput" value={{!!input}}>
<$action-setfield $tiddler=<<currentTiddler>> $field="myrow" $value=<<get-concatenated-value>>/>
</
$set>
</$set>
OK
</
$button>


damien Dupont

unread,
Aug 19, 2019, 12:48:06 PM8/19/19
to TiddlyWiki
Yeah, you're right, I didn't think to use a macro XD I will try tomorrow and I will let you know if it fits to my case ;) Thanks

damien Dupont

unread,
Aug 20, 2019, 5:18:39 AM8/20/19
to TiddlyWiki
It works perfectly !! Do you have an idea how to avoid writing the first "!" when the field is empty (before the first user entry) ?
Because when the table is made afterward, it creates a blank cell.

On Monday, 19 August 2019 18:45:16 UTC+2, BurningTreeC wrote:

damien Dupont

unread,
Aug 20, 2019, 5:24:36 AM8/20/19
to TiddlyWiki
I have found by myself, I just have to ignore blank when I use the list to make the table :
<$list filter="[all[current]get[date]split[!]!is[blank]]" variable="val">

Thanks again for your help ;)
Reply all
Reply to author
Forward
0 new messages