Listing all tiddlers with the same field value, using the tabs macro?

As discussed briefly here,

I’m trying to find a way to have a tab for each field value without duplicates for a specific field, and in each tab, having a bulleted list of all the tiddlers that have that value.

I’m not sure if this can be done with just the tabs macro, but I’ll try to explain a bit more in depth below.

Lets say I have a tiddler called “Navigator” and in that tiddler, I have the text <<tabs '[has[Content-Type]get[Content-Type]limit[1]subfilter<list-links>]'>> (which is not actually working filtering, sorry about that.)

Now I have tiddlers that have the field “Content-Type”

  • Tiddler 1 has a Content-Type of “Character”

  • Tiddler 2 has a Content-Type of “Character [[Main Character]]”

  • Tiddler 3 has a Content-Type of “Setting”

So each tab would be “Character, Main Character, Setting” and Tiddler 1 and 2 would show up in tab 1 (character), tiddler 2 would be in tab 2 (main character) and tiddler 3 in tab 3 (setting)

Not sure if that helps more or ends up being more confusing, but I’m trying to move away from having tags for everything, and to use fields and filtering more, since it seems super powerful

As a visual example, you can do this sort of thing using tags, as below

  • Tiddler titled “Navigator” with the text <<tabs '[prefix[Content-Type:]]'>>

  • Tiddler 1 tagged “Content-Type: Character”

  • Tiddler 2 tagged “Content-Type: Character, Content-Type: Main Character”

  • Tiddler 3 tagged “Content-Type: Setting”

Each “Content-Type:” tag having a list-links macro inside for its specific type, ie, “Content-Type: Character” would have the text of <<list-links '[tag[Content-Type: Character]]'>>

Once you have your list with duplicates, add

+[unique[]]

to the end of your filter expression to remove duplicates.

For the tabs macro, I don’t think you need subfilter or <list-links> – once the basic filter expression has the list of tab headings you need, you should be good to go.

<<tabs [has[Content-Type]get[Content-Type]]+[unique[]] >>

For this part, you’ll need a tabs template. Tabs are by default set up to display the content of a tiddler with the tab’s name. Of course, you could make a tiddler for each of the field values… But if you don’t want to do that, a tab template is the way to go…

See this discussion of tab templates

1 Like

That does solve my duplication problem, thank you! I was using +unique wrong haha

If your primary overview tiddler looks like this…

<<tabs template:"$:/tabs/tabTemplateAlt" tabsList:"[has[Content-Type]get[Content-Type]]+[unique[]]" >>

your tab template (which I’m titling $:/tabs/tabTemplateAlt above) would have content such as like:

{{{ [<currentTab>listed[Content-Type]] }}}

1 Like

Do you happen to know why this behavior is happening? (I’m not too sure how to describe it honestly)

When I have a tiddler with Content-Type and the values of “Character [[Main Character]]” I thought it was supposed to show as a tab for Character, and then a tab for Main Character

Edit: Ok, that triple curly bracket filter is exactly what I was trying to do but had no idea listed was a parameter, thank you for showing that!

Ah you need the step

enlist-input[] enlist-input documentation

so revise earlier suggestion as follows:

<<tabs template:"$:/tabs/tabTemplateAlt" tabsList:"[has[Content-Type]get[Content-Type]enlist-input[]]+[unique[]]" >>

Does that do what you need?

Yes! That combined with <<list-links '[<currentTab>listed[Content-Type]]'>> for the tabTemplate works exactly like I intended it!

Thank you for the help :smiley:

1 Like

I will just quickly point out using each and a nested list is relevant in many cases (if not this one) and if the field contains one value.

<$list filter="[all[tiddlers]each[fieldname]get[fieldname]]" variable=fieldvalue>
   Each <<fieldvalue>><br>
   <$list filter="[all[tiddlers]fieldname<fieldvalue>]" variable=tiddlername>
       <<tiddlername>> is a tiddler with <<fieldvalue>><br>
   </$list>
</$list>
  • each[fieldname]get[fieldname] is a common useful filter
  • The inner list could have additional conditions such as fieldname[$value$] if you want to test for a specific value

I’m sure later down the line I can find use for that :grinning_face_with_smiling_eyes:

1 Like

@Justin_H Please use the reply button on someone else’s reply, not the one at the bottom, as I have just done. So we know to whom you are replying and also consider @mentioning them, as I did at the beginning of this reply. Just type @.

1 Like

@TW_Tones Sorry 'bout that, made an edit to my last reply for context, hope that helps ^^

1 Like