Presenting: field value selector

635 views
Skip to first unread message

Mat

unread,
Sep 23, 2017, 12:53:55 PM9/23/17
to TiddlyWiki
TWaddle Global Enterprises Incorporated Limited International Multisuper presents the...


a drop down to select field value when creating new field


This is just a small tool for wikitext developers. Not very sexy for the general user.

Similar to the "new field name" dropdown, this shows a dropdown listing existing field values for that field name.

The incentive to create this was the list-before and list-after fields - it is frustratingly impossible to remember the title names to fill in. In the process of solving this, I made the dropdown general to handle values for all fields.

This does NOT overwrite any shadow tids - but the cost is that the little arrow appears below the "new field" area, rather than integrated into it.


<:-)

TonyM

unread,
Sep 25, 2017, 8:01:05 PM9/25/17
to TiddlyWiki
Mat,

Thanks, for this. Personally I think this is an essential feature. It is some what related to my comments on Fields as first class citizens https://groups.google.com/forum/?hl=en#!msg/tiddlywikidev/iw59ThjJID8/bQoqHJNtBAAJ;context-place=forum/tiddlywikidev

Great work
Tony

J Mc

unread,
Jan 13, 2018, 2:47:29 PM1/13/18
to TiddlyWiki
Mat,
While I think this is a very useful feature, I can't get it to work with any other fields in my tiddlers.
Can you put an example on Tiddlyspot or give some help please
J Mc

HC Haase

unread,
Nov 13, 2018, 6:38:52 AM11/13/18
to TiddlyWiki
Hi Mat
I really like to use your "plugin" it could be quite handy in some cases. but like J MC  I cant get it to work. Is there a bug?

Cyrill

unread,
Jun 17, 2020, 4:31:09 AM6/17/20
to TiddlyWiki
Hey,

last time i frequently use your macro, but from version 5.122 it unfortunatly dont work anymore.
It shows previously unused field name, which is not right ....

Perhaps some brains here could have a closer look to the code modification between ..
Beste Regards

Mat

unread,
Jun 24, 2020, 4:16:16 PM6/24/20
to TiddlyWiki

Damon Pritchett

unread,
Jun 24, 2020, 5:52:14 PM6/24/20
to TiddlyWiki
Thanks Mat for a wonderful addition. Seems to work beautifully now.

I took the liberty of modifying your field selector for my specific application. I am using a certain field to contain a tiddler title and I made a modification such that the dropdown lists a list of tiddlers tagged with a certain tag instead of saying the field name has not been used before. (I've attached the modification.) This works very well so far, but I would like to make a couple of other mods and I'm not sure how to do so.

I would like to have the list of tiddlers come up only when I'm using a certain field or two: namely the mother and father fields. If I'm editing any other field, I would like it to be have as you originally intended.

I'm anticipating my list of tiddlers to become quite large, so what I would like to add is the capability of typing in the field input box to narrow down the list of tiddlers or previously used field values. 

I'm still researching on my own how this might be down, but this is quite a stretch for my meager capabilities at the moment.

Thanks,

Damon

On Wednesday, June 24, 2020 at 1:16:16 PM UTC-7, Mat wrote:
UPDATED


<:-)
$___TWaddle_fieldvalueselector.json

TW Tones

unread,
Jun 24, 2020, 6:32:26 PM6/24/20
to TiddlyWiki
Mat,

Thanks for updating this. Its quite an elegant solution. Rather than me "forking" your solution are you interested in some slight feature changes?
I am happy to contribute code and methods.
  • For example if the fieldname exists as a tiddler and contains a field "field-values-filter" it will use that rather than existing values?
  • An option to select such values after field creation
  • Some other ideas
Otherwise if you wish to keep this solution as is, may I use some of your techniques in other solutions I am developing? effectively steal you code?

I see value in using this to extend the concept of Autonomous fields raised earlier by me

Regards
TW Tones

Mat

unread,
Jun 24, 2020, 6:48:25 PM6/24/20
to TiddlyWiki
Damon Pritchett wrote:
I would like to have the list of tiddlers come up only when I'm using a certain field or two: namely the mother and father fields. If I'm editing any other field, I would like it to be have as you originally intended.

That is what happens for list-before and list-after so if you study how those cases are handled, I think you should figure it out. 
 
I'm anticipating my list of tiddlers to become quite large, so what I would like to add is the capability of typing in the field input box to narrow down the list of tiddlers or previously used field values. 

As you note, typing (i.e setting focus to) anything outside of the popup closes the popup. So it would have to be a different mechanism. However, I use this tactic for my (initiated but not finished) attempt at a title picker, see elsewhere.

<:-)

Mat

unread,
Jun 24, 2020, 7:02:33 PM6/24/20
to TiddlyWiki
TW Tones (...I've been away from the boards for so long you even changed your name!? ;-)


Thanks for updating this. Its quite an elegant solution.

Thanks for the kind words. Personally I was somewhat taken aback now that I looked at it again, that it is so complex for something that small. I don't remember how I made it originally but it uses a few techniques that are not "typically me" (e.g using the LinkCatcherWidget) so I strongly suspect I based it on something else in the TW code.

Anyhow, I think you should make a fork because your ideas make it even more "niche", as far as I can tell. As noted, I most likely got the basic parts of it from the core code so do steal on ;-) I mean, unless otherwise specified all my shared stuff is for the benefit of the community so if people can take it even further and share, then that's just good.

BTW, I just updated with some minor tweaks (exchanging the old verbose link syntax for the modern compacted <$link/> syntax. No change in functionality.)

<:-)

TW Tones

unread,
Jun 24, 2020, 7:38:49 PM6/24/20
to TiddlyWiki
Mat,

Thanks I will fork it, but I may share back because I am hoping the Autonomouse tags, fields buttons etc... take off, in which case it would not be niche

A simple extra mechanism will use a field-values-filter if a tiddler of fieldname exists. It will have no impact on your field value selector, except when a "fieldtiddler" exists and in effect make field selector a little more configurable.

Regards
Tony

Cyrill

unread,
Jun 25, 2020, 5:53:36 AM6/25/20
to TiddlyWiki
Mat,
Glad to notice your update. Unfortunatly this also causes the following error...

Best Regards

Mat schrieb am Mittwoch, 24. Juni 2020 um 22:16:16 UTC+2:
UPDATED


<:-)
Screenshot fieldvalue.jpeg

TW Tones

unread,
Jun 25, 2020, 6:42:18 AM6/25/20
to TiddlyWiki
I believe the field needs to already exist with values elsewhere

Is that the case?

tony

Mat

unread,
Jun 25, 2020, 6:53:20 AM6/25/20
to TiddlyWiki
@Cyrill

As Tony notes, you must have used that field name previously, and it must have values set, in order for it to list the values for that field. Have you? There is no way to tell from your picture. What do you get if you put this in a tiddler:

<$list filter="[has[gesetz]]">
<$link/> - {{!!gesetz}}
<br>
</$list>

<:-)

Cyrill

unread,
Jun 25, 2020, 7:38:49 AM6/25/20
to TiddlyWiki
Hey Mat,

yes I have already entered values in this fields of the tiddlers.

Your code in Tiddlers text give me a long list with first tiddler title and the field "gesetz" value beside it.

Best

Mat

unread,
Jun 25, 2020, 2:22:17 PM6/25/20
to TiddlyWiki
UPDATED - I changed all enclosing quotes for triple quotes which could have an effect. If this doesn't solve your problem then I suspect you have funny characters in your fields. BTW, does it only fail for "gesetz" specifically or is it for all field names?

<:-)

Cyrill

unread,
Jun 26, 2020, 10:32:30 AM6/26/20
to TiddlyWiki
Mat,
it concern every field and only special character I use in the values is "-" between, p.e. in that form  "BGB - 242".
I use the "drift" edition, recently assembled here,  with some plugins. I tested to disable all plugins, but it seem to have no positive effect...

Mat

unread,
Jun 26, 2020, 10:47:30 AM6/26/20
to TiddlyWiki
What's your TW version? It must be recent enough to accept the following command:

<$link/>

If you put this in a tiddler, does this render the name of the tiddler or does it not render anything? If it doesn't render anything - you should upgrade your TW.

<:-)

Cyrill

unread,
Jun 27, 2020, 6:43:58 AM6/27/20
to TiddlyWiki
Mat,
I use
5.1.22,
this render the name of the tiddler...
when you wish i could send you the file directly via pm ?

Mat

unread,
Jun 27, 2020, 7:37:13 AM6/27/20
to TiddlyWiki
Cyrill wrote:
when you wish i could send you the file directly via pm ?

yeah, do.

<:-)

Mat

unread,
Jun 27, 2020, 7:38:00 AM6/27/20
to TiddlyWiki
...after you first remove any other plugins, please.

<:-)

OGNSYA

unread,
Jun 27, 2020, 9:09:50 AM6/27/20
to TiddlyWiki
That's so useful!

I tend to do a lot of field editing from other tiddlers though (for example, using TiddlyTables, directly in the cells).
Would love for values to be suggested there as well...

Any chance this can be implemented to work in any place where that field can be edited?

Mat

unread,
Jun 27, 2020, 10:36:04 AM6/27/20
to TiddlyWiki
OGNSYA wrote:
I tend to do a lot of field editing from other tiddlers though (for example, using TiddlyTables, directly in the cells).
Would love for values to be suggested there as well...

Any chance this can be implemented to work in any place where that field can be edited?

Hm. I guess it could be made so that instead of calling the EditTextWidget, you called a custom macro that simply contains the EditTextWidget but also a call to the fieldvalueselector. But if TiddlyTables allows direct editing of cells, I assume this is done by calling the EditTextWidget... i.e you'd have to remake TiddlyTables so that it instead called this custom macro. Definitely doable but TiddlyTables is not my plugin - and you only mention TiddlyTables as one example, indicating additional contexts.

Maybe you should make a gh request that the EditTextWidget can natively show used values. There could be some flag in the widget. I think it makes sense.

<:-)

OGNSYA

unread,
Jun 27, 2020, 2:07:33 PM6/27/20
to TiddlyWiki
Cool, I'll do a request.

I'm not a coder, and not familiar with github. 
I just created an account and found TW5 there.
Should I add this under "Issues" or "Pull requests"?
(first one seems inaccurate, second seems a bit too serious :D)



Saq Imtiaz

unread,
Jun 27, 2020, 2:21:45 PM6/27/20
to TiddlyWiki
This might be a bit tricky to parse out of context, but this is one of my macros for a field with a popup with previously used values. It accepts two parameters, the first a field and the second the filter to use to get the values.


\define editFieldPicker(field,filter)
<$edit-text tiddler="$(currentTiddler)$" field="$field$" focusPopup="$:/state/sqtc/new-puerh-form-$field$" class="tc-popup-handle"/><$reveal state="$:/state/sqtc/new-puerh-form-$field$" type="nomatch" text="" default="">
<div class="tc-block-dropdown">
<$linkcatcher to="$(currentTiddler)$!!$field$" >
<div class="tc-dropdown-item">
<$list filter="$filter$">
<$button tag="a" class="tc-btn-invisible" to={{!!title}}><$view field="caption">{{!!title}}</$view></$button>
</$list>
</div>
</$linkcatcher>
</div>
</$reveal>
\end

<<editFieldPicker "sqtc-puerh-recipe" """[sqtc-type[puerh]each[sqtc-puerh-recipe]get[sqtc-puerh-recipe]search:title{!!sqtc-puerh-recipe}]""" >>

Mat

unread,
Jun 27, 2020, 3:50:35 PM6/27/20
to TiddlyWiki
Yeah, OGNSYA, that code from Saq is good. Instead of Saq's interesting recipes, you can try it on tiddlyiki.com using e.g

<<editFieldPicker "my-field" """[tag[HelloThere]]""" >>

my-field:{{!!my-field}}

also, to be safe, the single quote characters should be replaced with triple quotes if you have any tiddler titles that contain quote characters.

To use this inside e.g TiddlyTables you'll have to modify TiddlyTables to make this macrocall instead of the edittext widget call.

<:-)

OGNSYA

unread,
Jun 27, 2020, 4:07:08 PM6/27/20
to TiddlyWiki
Works like a beauty! Thanks Mat and Saq.

This definitely seems like it should be part of TW by default... 
I'm not sure how to go about suggesting that though.
I'm not really a coder and don't use github... Should I add it as an "Issue" request there?

Mat

unread,
Jun 27, 2020, 4:29:37 PM6/27/20
to TiddlyWiki
OGNSYA wrote:
I'm not really a coder and don't use github... Should I add it as an "Issue" request there?

Yes, it'd be an Issue request using the "Idea" rather than "Bug" alternative. After you've posted it, you can edit both the text and the headline if you need to so if you get feedback suggestions on how you formulate it then this is not a big deal. Just sayin.

<:-)

林东吴

unread,
Jun 29, 2020, 2:32:49 AM6/29/20
to tiddl...@googlegroups.com
Thank you Mat!

I like this plugin! Can I have a folder based version for my NodeJS tw?

LinOnetwo

Mat <matia...@gmail.com> 于2020年6月28日周日 上午4:29写道:
--
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/5d835f88-3c02-4938-8f29-bef72813e2a9o%40googlegroups.com.

林东吴

unread,
Jun 29, 2020, 2:44:51 AM6/29/20
to tiddl...@googlegroups.com
Oh, I can see it is not a plugin, can I wrap it?

I will use this plugin.info:

{
  "title": "$:/plugins/mat/field-value-selector",
  "description": "Shows a dropdown listing existing field values for that field name.",
  "author": "Mat von TWaddle",
  "core-version": ">=5.1.22",
  "plugin-type": "plugin",
  "version": "0.0.1",
  "list": "readme"
}


林东吴 <lindo...@gmail.com> 于2020年6月29日周一 下午2:32写道:

Mat

unread,
Jun 29, 2020, 5:41:26 AM6/29/20
to TiddlyWiki
Lin Onetwo wrote:
Oh, I can see it is not a plugin, can I wrap it?

You do what you want. If you think it can be of value for others, just please share it also.

<:-) 

Cyrill Andreani

unread,
Jun 29, 2020, 10:52:12 AM6/29/20
to TiddlyWiki
Mat,
can you please send me your emailadress, cause i have no rights to answer you directly.

Many thanks in advance

Mat

unread,
Jun 29, 2020, 1:55:17 PM6/29/20
to TiddlyWiki
@David Gifford and @Cyrill

OK, after having had a look at Cyrills file, I note that the core shadow tiddler $:/core/ui/EditTemplate/fields is modified in... is it called Stroll or Roam (sorry). That core tiddler was updated in October last year (here) but Stroll/Roam seems to use the older version and possibly with some other customizations (I didn't search).

If this tiddler is deleted, then the core version of it is restored automatically, and fieldvalueselector works. But then any mods critical for Stroll/Roam are of course lost IF there in deed are any. That is hopefully something @David can answer - otherwise you (@Cyrill) can investigate any differences between the Stroll/Roam version of that tiddler and the updated core version. FieldValueSelector uses the
<<newFieldNameTiddler>> instead of the old $:/temp/newfieldname so that is the only difference that I can tell is problematic for sure.

<:-)

Cyrill Andreani

unread,
Jun 30, 2020, 5:11:59 AM6/30/20
to TiddlyWiki
Mat,
Thanks to your reactivity. The version is drift, derived from Roam/Stroll of course.
I delete the core tiddler and will check the usibility of this edition.
:)
Reply all
Reply to author
Forward
0 new messages