Multi-value fields

251 views
Skip to first unread message

Damon Pritchett

unread,
Aug 24, 2019, 2:32:38 PM8/24/19
to TiddlyWiki
Hello all,

Forgive me if this topic has been addressed before, but I couldn't easily find any topics that addressed it.

I'm using a custom field as a way to note a specific attribute of the tiddler. What I want to do is to be able to have that custom field contain multiple values with some separator like a semi-colon, comma, etc. Is this possible? I know I can do the same thing by assigning multiple tags to the tiddler, but am interested to use fields instead if possible. I'm trying to reserve tags for specific uses if I can.

As an example, let's say I have a tiddler that represents a species of bird. I have a field named color and the bird is three colors say white, yellow and red. Can I enter these into the color field as white; yellow; red or something similar? 

Thanks,

Damon

Mat

unread,
Aug 24, 2019, 2:56:06 PM8/24/19
to TiddlyWiki
You imply that you want some functionality other than what you explicitly state.

What you explicitly state is that you want to type "white; yellow; red"into a field - to which the reply is: yeah, just type exactly that.

Please explain more clearly what it is you want.

<:-)

Damon Pritchett

unread,
Aug 24, 2019, 3:01:19 PM8/24/19
to TiddlyWiki
Thanks Mat,

I'm sorry I didn't express clearly what I want to do. It's as simple as doing what you said I could do. I want to add multiple values to a field such as white; yellow; red. The question is are these separate values individually filterable? That is, can I now do a list of all tiddlers containing white in the color field even though there may be other values separated by the semi-colon?

Thanks,

Damon

Anjar

unread,
Aug 24, 2019, 3:21:28 PM8/24/19
to tiddl...@googlegroups.com
Hi Damon,

I think it should be quite straightforward: you can search in custom fields using ordinary filters, for example "[search:color[red]]" in your case. See https://tiddlywiki.com/static/search%2520Operator.html


Best,
Anders

Jed Carty

unread,
Aug 24, 2019, 5:00:15 PM8/24/19
to TiddlyWiki
The list, enlist filter operators and actionlistops widget are probably helpful here.

I also made a plugin that lets you create multiple fields that act like tags, which may be similar behaviour to what you want https://ooktech.com/jed/ExampleWikis/GenericTagFields/ .

Mat

unread,
Aug 24, 2019, 6:31:14 PM8/24/19
to TiddlyWiki
Yes, as Anjar says, filter-identifying tiddlers based on snips of field content works.

In addition to Jeds creation, you might also find http://toggle-in-field.tiddlyspot.com/ useful.

<:-)

A Gloom

unread,
Aug 25, 2019, 2:09:24 AM8/25/19
to TiddlyWiki
I have pondered upon having a field's content be considered multiple values like the tags field but I believe most fields content is considered a single value by the wiki.  I don't know how TW leverages the tags field so it appears as multiple values-- I get the impression the tags field is a collection of fields (each tag being an individual field) or perhaps a list to be manipulated by the wiki) but I could be wrong.  Even though a text search could ferret out "red" from a field containing "white red brown", any retrieval of the field value (without fancy filtering out text) would display that fields value as "white red brown" not just "red".  I don't think a field can contain multiple independent values, just a collection of values thats ends up considered a single value by the core (without extra plug in's). I think the intent was like with tiddlers-- to keep things to basic building blocks for easy reuse and assembling into constructs.

Jed McCarty's plug in (and the other suggested solutions) looks very interesting, I shall be pursuing this just like you-- many thanks for bringing up the subject.  And don't worry about bringing up a question-- unless it had been brought up recently (say within the last year), because with all the wiki updates, an answer from 2 years ago or more could had changed in the interval.

TonyM

unread,
Aug 25, 2019, 3:30:24 AM8/25/19
to TiddlyWiki
The list ops operators are all about multivalue fields. Tag is and they are often lists of titles they can be any values.

When you arrange tags a list field is created to store the order.

Multi vale fields need more work but have a look at the select widget with multiple.

Tags are a good first resort but I move that logic into custom fields freeing tags for ad hoc tagging.

Regards
Tony

A Gloom

unread,
Aug 25, 2019, 4:27:15 AM8/25/19
to TiddlyWiki
The list ops operators are all about multivalue fields. Tag is and they are often lists of titles they can be any values.

I haven't gotten to the more advanced list functions like listops or enlist-- but will be now that you made me aware of the multi value capability : )

I am not really a full fledged programmer--  I had been trained in such ages ago but now I'm a creator and learn enough so to be able to effect what I'm trying to do with my creating.

Questions here at the group are very useful-- often save me time by clueing me on things so I don't have to figure it all out on my own.

Flibbles

unread,
Aug 25, 2019, 6:53:17 AM8/25/19
to TiddlyWiki
What @TonyM said. Just store colors in a field as space separated, like: "red black brown". List and enlist can separate them out just fine.
```
<$list filter="[list[Cardinal!!colour]]" />
<$list filter="[enlist{Cardinal!!colour}]" />
```
both output
```
red
black
brown
```
Values with a space are handled with brackets. e.g. `yellow brown [[sky blue]]`

You can also search that color field with `[contains:colour[brown]]` for all tiddlers with brown as one of its list items.

You can collect all the colors of all North American birds with `[tag[North American]each:list-item[colour]]`

One last thing. Don't use the field color. It's reserved by tiddlywiki for stuff, and you'll get a color wheel as an input field.

PMario

unread,
Aug 25, 2019, 7:45:14 AM8/25/19
to TiddlyWiki
Hi,

I think the listops functions is what you want: https://tiddlywiki.com/#ActionListopsWidget

have fun!
mario

TonyM

unread,
Aug 25, 2019, 9:15:30 AM8/25/19
to TiddlyWiki
A Gloom,

A lot of people her have similar backstories. I think the people that stick with Tiddlywiki discover the power of some basic "programming" or advanced macro techniques that empower them to take control of their own software platform. In the modern world these are surprisingly uncommon skills that can be a life time investment that allows civilians to benefit from computing for their own purpose.

The birth of what we call the general purpose computer, one that can be programmed, not build for a single purpose was a revolution. However it is a revolution that is taking time to be democratised. Why should anyone be stopped from building their own database, record what they are passionate about, or build software tools to pursue their passions, dreams, livelihood or emotional and social participation?

Tiddlywiki is in my view the genesis of software 2.0 or is it version 10.0 now?

This community is also an example of the collective form of lifting individuals up by their bootstraps through shared effort. Something made all the more easier because of the principals both original by jeremy and those that have evolved of top of Jeremy's vision.

No you don't have to figure it all out on [your] own
 
Regards
Tony

Damon Pritchett

unread,
Aug 25, 2019, 2:07:50 PM8/25/19
to TiddlyWiki
Thanks to all who have commented. I love the discussion and have found it very helpful as I always do in this group. Tiddlywiki Rocks!

Damon

A Gloom

unread,
Aug 28, 2019, 11:22:42 PM8/28/19
to TiddlyWiki
Thanks to all who have commented. I love the discussion and have found it very helpful as I always do in this group. Tiddlywiki Rocks

I fully agree with Damon.  I have no regrets about intruding into the thread-- it sparked more answers, cleared a misconceoption and gave me leads to pursue that will move my own efforts forward.  Much gratitude to all.

Damon Pritchett

unread,
Apr 12, 2020, 1:55:23 PM4/12/20
to TiddlyWiki
Mat,

I tried your toggle-in-field macro yesterday. My initial looks are positive, but I'm having trouble getting it to work in what I want to do. What I'm trying to do is use the macro in a ViewTemplate so that I can set a field in certain tiddlers. I've tried various ways to have this work so that it modifies the current tiddler and not have to explicitly name the tiddler in the macro call, but haven't been successful yet. How do I call the macro from a ViewTemplate with the currentTiddler variable?

Thanks,

Damon

Mat

unread,
Apr 12, 2020, 2:39:02 PM4/12/20
to TiddlyWiki
@Damon - I made this for you which seems to work: http://fordamon.tiddlyspot.com/

<:-)

Damon Pritchett

unread,
Apr 12, 2020, 4:05:32 PM4/12/20
to TiddlyWiki
Thanks Mat,

That worked beautifully. I was on the right track, but was using double quotes around the parameters which was not needed. I still haven't grasped completely when they're required and when they're not.

Damon
Reply all
Reply to author
Forward
0 new messages