I spoke too soon...Q about viewing captions in view widget inside a macro

How do I use [get[caption]else{!!title}] inside of a view widget? I tried numerous methods and nothing worked.

It is inside a macro, so I want to do: <$view tiddler="$tiddler$" field=“caption if tiddler has a caption field, title if no caption”/>

(the macro itself works, that is not the issue)

This seems to work

<$view tiddler="$tiddler$" field={{{[[$tiddler$]has[caption]then[caption]else[title]]}}}/>

Thanks Mark! Blessings to you. That works great.

@DaveGifford just for completness the traditional way was

<$view tiddler="$tiddler$" field=“caption”>
   <$view tiddler="$tiddler$" field=“title”/>
</$view>

Because The content of the <$view> widget is displayed if the field or property is missing or empty. https://tiddlywiki.com/#ViewWidget

Note how the middle view widget is terminated with />and it is only displayed if the caption field does not return anything, is empty.

Thanks Anthony! It is helpful to see the options. Blessings.

1 Like