Indirect addressing

I am trying to get indirect addressing to work. I have seen an example somewhere in my travels but can not find it again. Hope someone can help me.

Tiddler1 has field pictureURL="WA-image-2543’
Tiddler WA-image-2543 had field imageURL=“Media/WA/image-2543.jpg”

The view template for tiddler1 needs to display the image pointed to by the tiddler whose title is in its field pictureURL where the actual URL is in its field imageURL…

The last try came from chatGPT and also failed

<$set name="picURL" value={{{ [<currentTiddler>get[pictureURL]] }}} >
  {{ [<picURL>get[imageURL]] }}
</$set>

bobj

Try this:

<$image source={{{ [<currentTiddler>get[pictureURL]get[imageURL]] }}}/>

Notes:

  • The double indirection is performed by the source={{{ [...] }}} filtered transclusion, so the $set widget isn’t needed… unless there is some other reason why you want the “picURL” variable.
  • For most use cases, the <$set name="varname" value={{{ [somefilter] }}}> syntax can be replaced by the more concise <$let varname={{{ [somefilter] }}}> syntax, as long as the filter is returning a single item (if the filter returns multiple items, only the first item is used).
  • In constrast, $set is useful with the name=... filter=... syntax when the filter is expected to return multiple items, where items containing spaces are automatically enclosed by double-square brackets (as in “foo bar [[mumble frotz]] gronk [[snork snerfle]] plurm”)

-e

1 Like

Ah, @EricShulman , I was soooo close :slight_smile:

Bobj