Indirect field question - editing values

60 views
Skip to first unread message

Steven Schneider

unread,
Jul 22, 2019, 5:42:01 PM7/22/19
to TiddlyWiki
I have a bunch of tiddlers, and each of my tiddlers has a bunch of tags. For each of the tags in a tiddler, I'd like to use edit-text to create an opportunity to enter a value in a field named similarly to the tag (replacing [spaces] with  [-] hyphens (thats line 2 below, replacing spaces with a "-" using the split and join plugins at https://tobibeer.github.io/tw5-plugins)).

I'm having trouble, however, writing back to the original tiddler in the proper field; my <$action-setfield> is not writing to the proper field.

Suggestion?

Thanks, 

//steve.



<$list filter="[is[current]tags[]">
<$vars thisField={{{[<currentTiddler>split[ ]join[-]]}}}>

<<thisField>>:<br>
<$edit-text tiddler=<<thisField>> field="text"/>
<$button>
Update
<$action-setfield $tiddler=<<thisProject>> <<thisField>>={{thisField}}/>
</$button>
<br>

I consistently get a field called <<thisField: with a value of true

Clearly, I don't know how to reference either my fieldName or the value of the field (currently in a temp tiddler) --

Suggestions?

Thanks in advance,

//steve.

Mat

unread,
Jul 22, 2019, 5:54:46 PM7/22/19
to TiddlyWiki
Hi Steve

The VarsWidet can only be used for "simple values". I'm unsure what exactly this means but, anyway, I suggest you try with the SetWidet.

<$set name=thisField value={{{....}}} >

Also, you may appreicate to know that 5.1.20 will have split and join for such search-and-replace operations.

And if people support the slugify request, then maybe the Gods will hear our prayers one day.

<:-)

Mark S.

unread,
Jul 22, 2019, 7:05:55 PM7/22/19
to TiddlyWiki
There was a lot going on. Mismatched vars and list ... maybe just a paste error.

Most importantly, in this:

<<thisField>>={{thisField}}

you're attempting to dynamically specify a field name on the left side of an attribute. I don't believe that
is possible without a macro.

You also specify a <<thisProject>> variable, without showing where it came from or what it means.

Also, I'm not sure if Tobias' operators work the way you're using them. Unfortunately, there don't seem to be any simple examples
of usage on his site.

So, instead, perhaps consider using the pre-release version of TW, which has split and join operators.

Putting this all together, the following seems to work using the pre-release, assuming that it's ok to use another tiddler, $/temp/values for your working
values. Note that it usually doesn't work to edit fields of the same tiddler that you're displaying.

Personally, I think you'll avoid a lot of headaches down the road if you don't use spaces in tag names, but maybe that's just me.

Good luck!

\define mybutton()
<$button>
Update
<$action-setfield $(thisField)$={{$:/temp/values!!$(thisField)$}}/>
</$button><br/><br/>
\end

<$list filter="[is[current]tags[]]" variable="curTag">
<$vars thisField={{{[title<curTag>split[ ]join[-]]}}} >
<<thisField>>:
<$edit-text tiddler="$:/temp/values" field=<<thisField>> />
<br/
>
<<mybutton>>
</$vars>
</
$list>


TonyM

unread,
Jul 22, 2019, 8:29:11 PM7/22/19
to TiddlyWiki
Steve

I posted a more general solution to editing fields from the view tiddler mode here https://groups.google.com/forum/?hl=en#!topic/tiddlywiki/kLqyVrjcJ50 which should help you edit items in the current tiddler, without any temp tiddlers.

See also my reply in https://groups.google.com/forum/?hl=en#!topic/tiddlywiki/GhsrGyK7eIk that covers concatination and why you have to do it.

Regards
Tony

Mohammad

unread,
Jul 22, 2019, 10:30:21 PM7/22/19
to TiddlyWiki
Steve,
 There is a great solution bu Ton Gerner!

And click on the big star on the sidebar you will see the Field edit section and you can manipulate tiddler fields there!

--Mohammad
Reply all
Reply to author
Forward
0 new messages