Be aware that [get[A]]
will get the value of the field A for EVERY tiddlers of the wiki, here you will get only a single value because the a variable contains the first result of a filtered transclusion. To get the value of the current tiddler, you can either do a={{!!a}}
, a={{{ [<currentTiddler>get[a]] }}}
, a={{{ [{!!a}] }}}
…
Also note that you can set several variables in a single vars widget. The let widget does the same but with the added bonus to be able to use variables declared inside the same let widget, so you could do this:
<$let a={{!!a}} b={{!!b}} c={{{ [<a>divide<b>fixed[1]] }}}>
<<c>>
</$let>
In some case it’s not necessary to use variables at all:
{{{ [{!!a}divide{!!b}fixed[1]] }}}
To set the value of a field, you can use the action-setfield widget. It will be triggered within a triggering widget (for example a button widget), and apply the value to the designated field :
<$edit-text field="a"/>/<$edit-text field="b"/><$button actions="""
<$action-setfield c={{{ [{!!a}divide{!!b}fixed[1]] }}}/>
""">={{!!c}}</$button>
Learn more about filters here: Filters
EDIT: if you want to get a bit fancy:
\define calc() <$action-setfield c={{{ [{!!a}divide{!!b}fixed[1]] }}}/>
\define input(field)<$edit-text inputActions=<<calc>> type="number" field=<<__field__>> />
<<input a>>/<<input b>>=<$button actions=<<result>> >{{!!c}}</$button>