Chris,
This may be one way to do it (hopefully) :
\define getLand()
<$select tiddler=<<currentTiddler>> field="land" actions="<$action-setfield
sort={{landcodes##$(sort-code)$}}/>">
<$list filter='[[landcodes]indexes[]sort[title]]'>
<option value=<<currentTiddler>>><$view field='title'></option>
</$list>
</$select>
\end
<$set name="sort-code" value={{!!land}}>
<<getLand>>
</$set>
On Tuesday, February 5, 2019 at 8:46:38 PM UTC+7, Chris Brouwer wrote:
>
> Hello all,
>
> I have the following situation, but can't acheive my goal. What am I doing
> wrong here ?
>
> I hav a Datatiddler containing country codes (abbreviations) as indices
> and a sort code as values, like this:
>
> CZ:01
> SK:02
> HU:03
> RO:04
> SRB:05
>
> I have a tiddler with a Select widget, where I let the user choose a
> country code.
> The resulting code is correctly placed in the "country" field. So far so
> good.
>
> Here's the catch:
> I also would like to place the sort code in a seperate field of the same
> tiddler. But accessing the DataTiddler seems to work only when I use a
> hardcoded countrycode, like {{landcodes##RO}}.
>
> But what I would like is: {{landcodes##<<land>>}}, or whatever way to get
> to the correct value. I have tried constructs with "<<", "$(", '"""$' but
> nothing seems to do the trick.
>
> Any suggestions ?
>
> Here is the contents of my test-tiddler:
> -----
> \define update-sort()
> <$vars lnd={{!!land}} >
> <$action-setfield $tiddler=<<currentTiddler>> $field="sort"
> $value={{landcodes##<<lnd>>}} />
> </$vars>
> \end
>
> \define getLand()
> <$select tiddler=<<currentTiddler>> field="land" actions=<<update-sort>> >
> <$list filter='[[landcodes]indexes[]sort[title]]' listItem=selectedList >
> <option value=<<selectedList>>><$view field='title'></option>
> </$list>
> </$select>
> \end
>
> <<getLand>>
> -----
>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/b5944923-cbdc-4228-84a8-b99f8645026b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.