Use a dataTiddler to create a Table: How to display both index and its value

76 views
Skip to first unread message

Mohammad

unread,
Jan 31, 2019, 9:46:48 AM1/31/19
to tiddl...@googlegroups.com
I am working on some tables summarize examples for some filters in TW.


So I have a dataTiddler like below

Title: data/search-filter
Type: application/x-tiddler-dictionary

search in all fields: [search:*[keyword]]
search only
in title: [search:title[keyword]]
search only
in field myfield: [search:myfield[keyword]]


And I have a macro like below:

\define mytable(data-tiddler:"data/search-filter")
<$set name="dataTid" value=<<__data-tiddler__>> >
<$list filter="[<dataTid>indexes[]]" variable="idx">
<$set name="data" tiddler=<<dataTid>> index=<<idx>>
>
<tr><td> <<idx>> </td><td> <<data>> </td> </tr>
</
$set>
</$list>
</
$set>
\end


And then I invoke the macro as below


<table>
<
<mytable "data/search-filter">>
</table>


It works, but my question is:
  1. I use a macro and a list widget to loop over all dataTiddler indexes
  2. I use a set widget to get the value of each indexes, because I cannot directly access the value
So, IS THERE ANY SIMPLER, BETTER SOLUTION TO LIST THE INDEX-VALUE SET WHEN BOTH ARE VARIABLE?

--Mohammad

Mohammad

unread,
Jan 31, 2019, 10:05:28 AM1/31/19
to TiddlyWiki
I realized one solution is to use the transclude widget as below

<$transclude tiddler=<<dataTid>> index=<<idx>>/>

Any other solution?

S. S.

unread,
Jan 31, 2019, 12:35:02 PM1/31/19
to TiddlyWiki
This might help:

<ul>
      <$list filter="[[data/search-filter]indexes[]]" variable="thisIndex">
         <li><<thisIndex>> : <$view tiddler="data/search-filter" index=<<thisIndex>>/></li>
      </$list>
</ul>

Mohammad

unread,
Jan 31, 2019, 1:05:39 PM1/31/19
to TiddlyWiki
Hi S.S. that's true! Seems transclude, and view widget do the job!

Thank you
Reply all
Reply to author
Forward
0 new messages