Transclusion Dictionary Tiddler with let-defined variable for key

Hi, Basic syntax question i hope:

I have a dictionary “Site Names Copy” tiddler that looks like:

dom1.org: "TW World 1"
dom2.org: "TW World 2"

In other tiddlers I want to derive the site name from the domain name by setting a variable dom to the hostname and then pass it to a transclusion that looks up the domain in the Site Names dictionary:

If pass the domain name dom1.org as a string the lookup works:

<$let 
 site={{Site Names Copy##dom1.org}} >
<hr>
<<site >>
</$let>

I get:
“TW World 1”

But if I have not succeeded in passing the domain name as a variable. This does not work:

<$let 
 dom=dom1.org
 site={{Site Names Copy##<<dom>>}} >
<hr>
<<site >>
</$let>

What is the correct way to pass variable as the lookup key to that transclusion?
Is this explained somewhere? I didn’t find it in the https://tiddlywiki.com/ docs.

Thanks you for your help.

Dan

Remember curly braces are usually the short form of wikitext;

When you need to pass variables inside one of these shortform’s the most direct way is to use the longer forms.

{{Site Names Copy##dom1.org}} <!-- static -->

</$view tiddler="Site Names Copy" index=<<dom>> ... /> <!-- not tested recently by me -->

{{{ [[Site Names Copy]getindex<dom>] }}} <!-- not tested by me -->

This did the trick:

<$view tiddler="Site Names Copy" index=<<dom>>></$view>

Works great. :slight_smile: Thank you.

Dan

1 Like