Concatenating contents of multiple fields into one textfield

129 views
Skip to first unread message

odin...@gmail.com

unread,
Dec 30, 2020, 3:00:16 PM12/30/20
to TiddlyWiki
I am working on a little plugin that allows users to fill in a short reflection on the day. There are 3 questions and I am using an edit-text widget to provide for an input. The structure is like this:

!! I am grateful for...
<$edit-text> for the answer stored in a temp tiddler field
!! What would make today great?
<$edit-text> for the answer stored in a temp tiddler field 
!! Daily affirmation. I am...
<$edit-text> for the answer stored in a temp tiddler field  
 

Now I can use a viewtemplate to show this in the tiddler that is gets stored into, just like I did with my recipe plugin. But in this case I would like to Concatenate the questions and the answers into one text field so that users can later edit their journal entry. But I can't figure out how to.

I think the answer lies in either a macro or the vars widget (maybe both). But I am stuck and I am not understanding the documentation correctly.

So far I have this

\define sixminutejournal(grateful, great, affirmation) 
!!! I am grateful for:

$grateful$

!!! What would make today great?

$great$

!!! Daily affirmation. I am ...

$affirmation$
\end

And then calling the macro with inside the button that creates the tiddler:
    text=<<sixminutejournal grateful:{{$:/temp/odin/sixminutejournal!!sixminute-grateful}} great:{{$:/temp/odin/sixminutejournal!!sixminute-great}} affirmation:{{$:/temp/odin/sixminutejournal!!sixminute-affirmation}}>>

But this leads to:

!!! I am grateful for:

{{$:/temp/odin/sixminutejournal!!sixminute-grateful}}

!!! What would make today great?

{{$:/temp/odin/sixminutejournal!!sixminute-great}}

!!! Daily affirmation. I am ...

{{$:/temp/odin/sixminutejournal!!sixminute-affirmation}}


How do I get this to fill in the answers and paste it instead?

TW Tones

unread,
Dec 30, 2020, 5:49:45 PM12/30/20
to TiddlyWiki
The approach you are using is valid; Using a macro and replaceable parameters, however

use the $macrocall widget for sixminutejournal then the parameters will accept {{transclusions}} or <<macros>>

The method you used is not valid, inside simple macro calls.

Regards
Tony

odin...@gmail.com

unread,
Dec 31, 2020, 10:57:33 AM12/31/20
to TiddlyWiki
Thanks for the reply!

what would the correct syntax be in this case?

<$action-createtiddler
    $basetitle=<<newTitle>>
    tags="[[Six Minute Journal]]"
    text=<$macrocall $name="sixminutejournal" grateful={{$:/temp/odin/sixminutejournal!!sixminute-grateful}} great={{$:/temp/odin/sixminutejournal!!sixminute-great}} affirmation={{$:/temp/odin/sixminutejournal!!sixminute-affirmation}}>
    sixminute-time='21:00'


This doesn't work. I tried some options in which I incase it with ', or  ", or {{{ }}}. But I think I am not getting the syntax right. Or should I use a different widget in the first place?
Op woensdag 30 december 2020 om 23:49:45 UTC+1 schreef TW Tones:

TW Tones

unread,
Jan 6, 2021, 1:32:56 AM1/6/21
to TiddlyWiki
See my comments inline

On Friday, 1 January 2021 at 02:57:33 UTC+11 Odin wrote:
Thanks for the reply!

what would the correct syntax be in this case?

<$action-createtiddler
    $basetitle=<<newTitle>>
    tags="[[Six Minute Journal]]"
    text=<$macrocall $name="sixminutejournal" grateful={{$:/temp/odin/sixminutejournal!!sixminute-grateful}} great={{$:/temp/odin/sixminutejournal!!sixminute-great}} affirmation={{$:/temp/odin/sixminutejournal!!sixminute-affirmation}}>
    sixminute-time='21:00'


  • Should >  be /> ?
  • Where is the end of the action widget />?
  • Why cram macrocall inside the action widget, why not establish the value to use there with a variable before the action widget, you may have to wikify the result.
\define parameters()  grateful={{$:/temp/odin/sixminutejournal!!sixminute-grateful}} great={{$:/temp/odin/sixminutejournal!!sixminute-great}} affirmation={{$:/temp/odin/sixminutejournal!!sixminute-affirmation}}
<$wikify name=parameters text=<<parameters>> >
<!-- reuse same variable name -->
<$action-createtiddler
    $basetitle=<<newTitle>>
    tags="[[Six Minute Journal]]"
    text=<<parameters>>
    sixminute-time='21:00'
/>

 

Pit.W.

unread,
Jan 6, 2021, 4:51:14 AM1/6/21
to tiddl...@googlegroups.com

Odin,
it would be interesting to see the complete solution once you have assembled it. Could you publish it?

Pit

--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/80683332-1fbb-4791-9c0b-20bd8c5c0334n%40googlegroups.com.


_________________________________________________________________
________________________________________________________
Ihre E-Mail-Postfächer sicher & zentral an einem Ort. Jetzt wechseln und alte E-Mail-Adresse mitnehmen! https://www.eclipso.de


Odin

unread,
Jan 12, 2021, 12:39:29 PM1/12/21
to TiddlyWiki
@Pit,

Finally got it to a working state. This is what I got so far:  odinjorna.github.io/sixminutejournal/ 
How to try it out:
- Fill in the prompts in $:/plugins/odin/sixminutejournal/morninginput
- Go to the newly made tiddler via the 'recent' tab and open it
- It contains the questions and the answers you gave + a box with two more questions. After you fill these in and press the button, the box will disappear and the answers will be added to the text of the tiddler.
- When you open up the tiddler to edit, you can see it is just plain text. This makes it easier to edit your journal afterwards. 

Op woensdag 6 januari 2021 om 10:51:14 UTC+1 schreef Pit.W.:
Reply all
Reply to author
Forward
0 new messages