A better way to display those fields/tiddlers?

138 views
Skip to first unread message

Alessandro Gianni

unread,
Mar 11, 2021, 1:00:26 PM3/11/21
to TiddlyWiki
My last request for help was immediatly solved, so let me try again! :)

Let's say I have two kind of tiddlers:
people: John, Mary, Carl, etc.
languages: English, Italian, Spanish, etc.

my goal is that when I see John's tiddler, I have a list of languages he speaks, each linked to its own tiddler. It would be perfect if I could fit in more information (like, filter them by fluency or whatever), but let's not get ahead of ourself.

my initial tought process was to have prefixed fields in people tiddlers:
fieldname: language_english
value: English

fieldname: language_french
value: French

and in a person's tiddler set up a list like:
<$list filter="[all[current]fields[]prefix[language_]sort[title]]" variable="language">
<$vars lang={{{ [<currentTiddler>get<language>] }}}>
<$link to=<<lang>>/>
</$vars>
</$list>

Now this works. HOWEVER! It's not flexible at all. And as I said, it won't let me differentiate further, so to filter, let's say, only the languages in which John is fluent.

My wish would be actually something different that I don't know how to process. That is: list the actual pages and filter them out by a comparison with the current tiddler's fields. Something like:

each page has a field codename, for example:
fieldname: codename   value: english

compare it to John's tiddler's fields:
fieldname: english   value: 1

and use this comparison as a filter for [tag[languages]].

something like: [tag[languages] butonlyif <john><codename> compare:number:gt[0]]

This way, I could set up other values in John's tiddler (0, 1, 2, etc.) and being able to define and filter even further.

Thank you again for your time!

Saq Imtiaz

unread,
Mar 11, 2021, 1:28:52 PM3/11/21
to TiddlyWiki
What if instead of:
fieldname: language_english
value: English

you used:

fieldname: language_english
value: fluency_level, e.g: 1

So the presence of the language_english field tells you that the person speaks english, you get the name of the language from the part of the field name after the hyphen.
The value of the field gives you the fluency.



Alessandro Gianni

unread,
Mar 11, 2021, 1:46:16 PM3/11/21
to TiddlyWiki
but this wouldn't let me have a linked list (the tiddler would be called English, not languange_english), not to mention that having language_english as plain text seems kinda ugly. Or am I missing something?

Soren Bjornstad

unread,
Mar 11, 2021, 6:26:14 PM3/11/21
to TiddlyWiki
You could add a field on the language tiddler called, e.g., language_name containing english or whatever the part after language_ would be in your person tiddlers, then something like:

<$list filter="[all[current]fields[]prefix[language_]removeprefix[language_]]" variable="lang">
    <$list filter="[tag[languages]language_name<lang>]">
        ...insert list item for each language tiddler here
    </$list>
</$list>

Obviously you could replace the list-links with whatever logic you want for filtering by fluency.

Soren Bjornstad

unread,
Mar 11, 2021, 6:26:57 PM3/11/21
to TiddlyWiki
And ignore that last sentence, I revised that part out and forgot to remove the sentence. :)

Alessandro Gianni

unread,
Mar 11, 2021, 7:29:45 PM3/11/21
to TiddlyWiki
I actually found my own solution, which I like best (for now)... And it's quite reminds me of yours. Like, if only I saw it earlier! :)

<$list filter="[<currentTiddler>fields[]] :intersection[tag[languages]get[codename]]" variable="lang">
<$list filter="[tag[languages]field:codename<lang>]">
<$link/>
</$list>
</$list>

this requires that John has an english field (with any value) and the English tiddler has a codename:english field (all because field names can't have uppercase or spaces or whatever...!).

Thanks a lot guys! Learning to properly use operators seems to be quite a powerful tech for tiddlywiki.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages