Adding transclusions to a List - any ideas

Skip to first unread message

TonyM

unread,
Mar 22, 2020, 7:14:03 PM3/22/20
to TiddlyWiki
Folks,

I am enhancing an app and would like to select from a tiddler/fieldname pair available and add it to a list field

The list field selected-lists will subsequently look like this
{{tiddler1!!fieldname1}} {{tiddler2!!fieldnameA}} {{tiddler2!!fieldnameB}}

I now I will need to subsequently reorder, add and remove items from this list but they are not traditional titles
  • Has anyone done something like this before
  • Can the list ops operators help in this format
  • Should I instead store [[tiddlername1!!fieldname1]]?
Once populated I use the selected-lists field to provide input to a list/table of all instances, contained in all named lists.

Your guidance would be appreciated

Regards
Tony

Mark S.

unread,
Mar 22, 2020, 8:36:38 PM3/22/20
to TiddlyWiki
I don't know about the advisability of a list field with all transclusions, but this worked right out of the box:

<$button>Add to my list
<$action-listops $field="mylist" $subfilter="{{tiddler3!!otherfield}}"/>
</$button>

TonyM

unread,
Mar 22, 2020, 9:37:26 PM3/22/20
to TiddlyWiki
Mark

Thanks, 

Now I need to find out how to construct this from values
\define left-curlys() {{
\define right-curlys() }}
\definelist-reference() <<left-curleys>><<tiddlername>>!!<<fieldname>>
<<right-curleys>>
or <<left-curleys>>{{!!tiddlername}}!!{{!!fieldname}}<<right-curleys>>

Regards
Tony

TonyM

unread,
Mar 22, 2020, 11:21:22 PM3/22/20
to TiddlyWiki
Mark,

I have got this closer;

\define left-curlys() {{
\define right-curlys() }}
\define field-delimiter() !!
\define list-reference() {{{ [<instance>addsuffix<field-delimiter>addsuffix<list-field>addprefix<left-curlys>addsuffix<right-curlys>] }}}
<<select-object>><br>
<$list filter="[!is[system]fields[]addprefix[$:/landscape/fields/]field-list-object{!!selected-object}removeprefix[$:/landscape/fields/]]" variable=list-field>
   
<$list filter="[!is[system]has<list-field>sort[]]" variable=instance>
       
<<list-field>> in <<instance>> - <br>
       
<$button>
           
<$action-listops $field="selected-lists" $subfilter=<<list-reference>>/>
           +
       </
$button>
   
</$list>
</
$list>
However this code depends on other values and tiddlers

Unfortunately this results in selected-lists of
[[{{CMI Referrers List CSV!!select-consultant-list}}]] [[{{ORAMS Referrers list!!select-consultant-list}}]] {{{ {{Singleton!!office-consultants-list}} }}}

So I am close but don't have an explanation yet

Regards
Tony

TonyM

unread,
Mar 22, 2020, 11:50:35 PM3/22/20
to TiddlyWiki
Side Observation

`[[CMI Referrers List CSV!!select-consultant-list]]`

results in `wikipath/tiddlername/CMI%20Referrers%20List%20CSV!!select-consultant-list`

or a tiddler named "CMI Referrers List CSV!!select-consultant-list"

  • Which is interesting because it is a tiddler named after a tiddler and its field.
  • I wonder how it would fair using the tiddlername containing "!!"

Tony

Mark S.

unread,
Mar 23, 2020, 1:20:47 AM3/23/20
to TiddlyWiki
Since I don't quite know what you're trying to accomplish, I've put together a version that will append braces, though using a slightly different approach. See attached for field values.

<$vars lc="{{" rc="}}"
tiddlername={{!!tiddlername}}
fieldname={{!!fieldname}}
>

<$vars listreference={{{ [
<tiddlername>addprefix<lc>addsuffix[!!]addsuffix<fieldname>addsuffix<rc>] }}} >


<$button>Add to my list
<$action-listops $field="mylist" $subfilter=<<listreference>>/>
</$button>

</$vars>
</$vars>


listreference.json

TonyM

unread,
Mar 23, 2020, 1:44:12 AM3/23/20
to TiddlyWiki
Mark,

Thanks this really does work. I will try and implement it into my own. I am at a loss to know why mine was not working. Thanks very much

Tony

TonyM

unread,
Mar 23, 2020, 2:15:10 AM3/23/20
to TiddlyWiki
Mark,

My first approach was to use my code but change the list-reference from a macro to the use of $vars as you did and it immediately worked.
       <$vars list-reference={{{ [<instance>addsuffix<field-delimiter>addsuffix<list-field>addprefix<left-curlys>addsuffix<right-curlys>] }}} >
       <
<instance>> - <<list-field>>  <<list-reference>>

       <$button>
           <$action-listops $field="selected-lists" $subfilter=<
<list-reference>>/>
           +
       </$button>
<br>
       </$vars>

After a false start I converted this to the set widget, since there was only one variable, it too works now
       <$set name=list-reference value={{{ [<instance>addsuffix[!!]addsuffix<list-field>addprefix<left-curlys>addsuffix<right-curlys>] }}} >
       <$text text=<
<instance>>/> - <<list-field>>

       <$button>
           <$action-listops $field="selected-lists" $subfilter=<
<list-reference>>/>
           +
       </$button>
<br>
       </$set>

Thanks you helped me out of a bind.

I will see what I can do to generalise this and publish it.
  • Basically it searches all tiddlers using one or more custom list fields and on a click adds the tiddler-name!!text reference  to a tiddler field (Wrapped in transclude brackets)
  • Now if a list uses this field in its filter it will list all titles in all included list-fields. A list of multiple-list members.
  • This is another step in finding a way to make lists within fields even more useful
I think this shows how we could extend the handling of lists further.

Regards
Tony
Reply all
Reply to author
Forward
0 new messages