Transclude Combobox from procedure

In this discussion Feedback on documentation of filter operators - #12 by etardiff a combobox is used to get values from a particular field.
I would like to create a similar combobox by using a procedure.
Can someone please tell me where I’m going wrong.

\procedure combo-get(name)
@@.combobox
	<<name>> : <$edit-text field=<<name>> tag=input placeholder="type or select" />
	<$select field=<<name>>>
		<$list filter="[each[<<name>>]get[<<name>>]sort[]]">
			<option>{{!!title}}</option>
		</$list>
	</$select>
@@

\end

procedures_combo-get.json (439 Bytes)

1 Like

In filter syntax, the brackets indicate how a filter parameter is to be processed:

  • use square brackets for literal values;
    e.g., [tag[sometext]]
  • use angle brackets for variable references;
    e.g., [tag<somevar>]
  • use curly brackets for tiddler field/index references;
    e.g. [tag{tiddlertitle!!somefield}] or [tag{tiddlertitle##someindex}]
  • unlike wikitext syntax, the brackets in filter syntax are not doubled.

In addition:

  • if a field or index reference is for the current tiddler, the tiddlertitle portion is omitted
    (i.e., use [tag{!!somefield}] or [tag{##someindex}])
  • if the reference is to a tiddler’s text field, the !!somefield portion can be optionally omitted
    (i.e, [tag{tiddlertitle}] is the same as [tag{tiddlertitle!!text}]

Thus, for your specific use-case, you need to change:

<$list filter="[each[<<name>>]get[<<name>>]sort[]]">

to

<$list filter="[each<name>get<name>sort[]]">

enjoy,
-e

1 Like

Thank you @EricShulman
I thought it had to do with the brackets and had tried

<$list filter="[each[<name>]get[<name>]sort[]]">

but not your solution, without [ or ] brackets

<$list filter="[each<name>get<name>sort[]]">

Works fine now.

One tip on this is that wikitext also permits html, as a result we need to differentiate between html tags <div> and other tiddlywiki script <<varname>> similarly someone may wish to use curly braces { group content} so we use the less likely {{ transclusion }} or {{{ filtered transclusion }}} for what I call TiddlyWiki Script. Similarly for square braces [ ].

When used inside a filter, the filter is delimited already however you provide the filter so we need not double brace everything. We actualy discussed this recently - cant find yet.

@Sunny

Thanks @TW_Tones
I really need to read more.

1 Like

Yes, you can often use the hunt and peck method for knowledge, but focused reading does help you remember the framework on which to hang the details.