Folks,
I am yet to master the setmultiplevariables widget and hope someone could help me;
See this code snippit
<$setmultiplevariables
$names="[enlist{$:/config/active-modes}]"
$values="[enlist{$:/config/active-modes}] :map[<..currentTiddler>get<currentTiddler>]">
<hr>
design-mode=<<design-mode>>
</$setmultiplevariables>
In the above a list of fieldnames is found in the $:/config/active-modes tiddler.
This is designed to set a variable of the same name to the value of the fieldname found in the current tiddler.
In the above case my tiddler had a field called design-mode equal to yes, with design-mode=<<design-mode>>
returning design-mode=yes
.
However I would like the above setmultiplevariables widget to do the following if there is no fieldname in the current tiddler (or it has no value).
I have no idea how to do it, and I have tried.
If the fieldname does not have a value, I would like to add the prefix “$:/config/” to that field name and return the content of that tiddler title, setting in the variable (also named the same as fieldname).
Purpose:
I want a variable set for each of the named fieldnames, first attempting to get the value from a field of that name on the current tiddler and setting the variable to the value found there.
If there is no local / current Tiddler field I want to get the value from the config tiddlers text field instead.
Any advice warmly welcomed.