Shiraz dynamic tables, use variable in table filter

I’ve built a template applied on all pages tagged with author to gather their books in a Shiraz Dynamic Table.

I’m extracting the author from the page in a variable <cauthor> (current author).

I’ve added a search field in the dynamic table as per Shiraz’s relevant tutorial.

I’ve tried adding the <cauthor> value in the paths used to avoid crossing the streams give each Author page an independent search state, but it didn’t work. Without my failed hack below, all open Author tiddlers share the same search terms.

I guess it’s a usual case of wrong use of brackets? As I see it in the More → Explorer sidebar, <cauthor> is interpreted literally and becomes a static part of the resulting path.

<$list filter="[all[current]tag[author]]">
    <$set name="cauthor" value={{!!title}}>

        !!! Works by ''<<cauthor>>'' 
			
		Filter and search in table
		<$edit-text 
			tiddler="$:/temp/dtable/<cauthor>/search" 
			filed=text 
			tag=input 
			default="" />
		<$button 
			set="$:/temp/dtable/<cauthor>/search" 
			setTo="" 
			tooltip="clear searchbox">❌</$button>

		<<table-dynamic 
			filter: "[contains:author<cauthor>search{$:/temp/dtable/<cauthor>/search}]" 
			fields: "tbl-expand title tags" 
			stateTiddler: "" 
			editButton: "yes" 
			pagination: "yes">>

    </$set>
</$list>

This part is wrong $:/temp/dtable/<cauthor>/search

Simple and quick solution:

\define searchTid() $:/temp/dtable/$(cauthor)$/search
.
.
		<<table-dynamic 
			filter: "[contains:author<cauthor>search<searchTid>]" 
			fields: "tbl-expand title tags" 
			stateTiddler: "" 
			editButton: "yes" 
			pagination: "yes">>

1 Like

I tried your solution but it doesn’t work unfortunately. The initial Dynamic Table is empty (it had proper results before trying to implement the cauthor part).

Τyping in the search field does create the appropriate temp tiddler under $:/temp/dtable/$(cauthor)$/search but it doesn’t seem to used in the Dynamic Table which starts off empty and remains empty. I guess something is wrong in the table’s filter query:

\define searchAuthor() $:/temp/dtable/$(cauthor)$/search
<$list filter="[all[current]tag[author]]">
    <$set name="cauthor" value={{!!title}}>

        !!! Works by ''<<cauthor>>'' 
			
		Filter and search in table
		<$edit-text 
			tiddler=<<searchAuthor>>
			filed=text 
			tag=input 
			default="" />
		<$button 
			set=<<searchAuthor>>
			setTo="" 
			tooltip="clear searchbox">❌</$button>

		<<table-dynamic 
			filter: "[contains:author<cauthor>search<searchAuthor>]"
			fields: "tbl-expand title tags" 
			stateTiddler: "" 
			editButton: "yes" 
			pagination: "yes">>

    </$set>
</$list>

Your original filter used search{...} (note the curly braces). This means “search for matches using the text contained in the specified tiddler title”.

However, the current filter uses search<...> (note the angle brackets), which means “search for text matching the specified tiddler title”.

What you need to do is to first get[...] the contents of the specified search input tiddler title, and then use that value to actually perform the search. Perhaps something like this will work:

<$let theSearchText={{{ [<searchAuthor>get[text]] }}}>
<<table-dynamic 
	filter: "[contains:author<cauthor>search<theSearchText>]"
	fields: "tbl-expand title tags" 
	stateTiddler: "" 
	editButton: "yes" 
	pagination: "yes">>
</$let>

Let me know how it goes…

-e

1 Like

As usual, your suggestion works :slight_smile:

The other idea I had was to keep the search string in a field of the author tiddler. They would be separated by definition and I would not clutter my temp folder with extra tiddlers.

I see your question is solved, @Lamnatos

Still, in case it’s helpful: You seem to be doing a bibliographic database…

If you have lots of tiddlers, you may find it convenient to make automatic templates show up at the nodes that correspond to authors — rather than having to create a tiddler, and tag it author, in order to get your dynamic table. This is a technique talked about elsewhere, most recently as [“virtual tiddlers”] …(Virtual tiddlers)

I have thousands of biblio records for my personal library and other research-resources of interest. Building on the core bibliographic functions of refnotes by @Mohammad, I’ve been steadily adding features:

  • In the tiddler for a book or article, all author and editor names display as links.
  • Even if there’s technically no tiddler for that author/editor name (The tiddler is “missing”), we see a dynamic table for books authored and edited by that person. This is accomplished with a template (with cascade conditions if you want to get fancy).
  • Extra stretch: I’ve defined custom functions that begin to cope with the fact that some imported biblio records show names as “Nussbaum, Martha C.” while others come in as “Martha Nussbaum (ed)”… Would be nice to maximize recognition of that same person “on the fly” across these differences (without needing to clean up first), so I’ve made quite a bit of progress on that.

Here’s a landing page where you can click on some author names to see what else shows up under the same and similar names (Perhaps additional aspects of the site will prove helpful while you’re developing your wiki):

https://biblio-springer.tiddlyhost.com/#may1996mind

A solution like this doesn’t prevent you from making tiddlers for authors of interest (where you can add notes, biographical data, etc. — in addition to accessing dynamic tables), but it speeds up the “intertwingularity” of a biblio-oriented wiki.

4 Likes

Ah, I forget to tell you, to get the search term from temp tiddler. I see Eric has given the correct solution.

1 Like

That’s a nice idea, I’m already applying templates to missing tag tiddlers on my Bookmarks TW to show a list of bookmark tiddlers tagged with the current tag. I’ve defined a view template that opens with:

<$list filter="[tag<currentTiddler>limit[1]]" variable="">

and is thus applied regardless of whether the tiddler is missing or not. It makes sense to me because when it comes to bookmark organization, there are way too many tags to keep track of them. On my bookkeeping TW, the authors are relatively few and I tend to manage them by hand. I might apply it there too, I’ll see.

I really like your book-thumbnails page, I think I’ll steal it. I’ve been thinking of having a page with a random, limited selection of book covers, as a source of inspiration and something to resemble the physical, all-you-can-see bookshelfs of yore.

1 Like

As a final note, I’ve managed to transform it to using current tiddler fields instead of generating separate temp tiddlers. I ended up with a simpler code that does the same thing, without relying on additional external tiddlers.

I’m quite proud that I’ve wrestled through all those different bracket combinations, big shout out to https://pesky-brackets.tiddlyhost.com and to everyone here who helped me through this :slight_smile:

Current code:

<$list filter="[all[current]tag[author]]">

        !!! Works by ''{{!!title}}'' 
		<$edit-text 
			field=searchTerm
			tag=input 
			size=50
			placeholder="Search in title, text, tags" />
		<$button 
			set="!!searchTerm"
			setTo="" 
			tooltip="clear searchbox">❌</$button>

        <<table-dynamic 
	        filter: "[contains:author{!!title}search{!!searchTerm}]"
        	fields: "tbl-expand title tags" 
	        stateTiddler: "" 
        	editButton: "yes" 
        	pagination: "yes">>

</$list>
1 Like

Ah, if you like the thumbnails, you might also like this adaptation of the fanned-out CustomStoryTemplate:

https://biblio-springer.tiddlyhost.com/#Book%20array

Cheers!

1 Like

7 posts were split to a new topic: Coping with author name complexities in biblio records (bibtex, refnotes)