Building off TW Tones, here's a simple temperature converter using filters
to pull an input number from a state tiddler ( $:/_br/converter/state )
field named "temp-f" and use filter math operators to convert it to celsius
before editing another field (temp-c) in the same state tiddler. You can
paste the following code into a tiddler to play around with...
```
<table>
<tr>
<th colspan="2">Fahrenheit > Celsius</th>
</tr>
<tr>
<td style="width:5em"><$edit-text tiddler="$:/_br/converter/state"
field="temp-f"/></td>
<td>
<$list filter="$:/_br/converter/state
+[get[temp-f]subtract[32]multiply[5]divide[9]precision[4]]"
variable="convert-c">
<$text text=<<convert-c>>/>° Celsius (C)
</$list>
</td>
</tr>
</table>
```
On Wednesday, September 9, 2020 at 7:19:11 PM UTC-7 TW Tones wrote:
> Bob,
>
> 1. Is there a simple concatenation operator, like & or + that can be used
>> to concatenate strings? I know that a macro can do it but that seems very
>> confusing to a simple mind like me.
>
>
> 1. Concatenation
>
> There are many ways to concatenate with tiddlywiki, although for good
> reasons in may seem not as strait forward as you would expect. In part
> because where do you want this concatenated result used?
> Please provide a descriptive example of what you are currently try to
> achieve.
>
> With concatenation you will find these methods useful
>
> - Define a macro in which the concatenation occurs
> - You can use $(currentTiddler)$ and parameter $param$ for simple
> substitutions
> - Wiki fy that macro (with the same name is ok) just before you use it
> say in a filter and some parameters
> - You can use add-prefix/split/join/splitregext and other string
> handling.
>
> 2. Is there a way of doing simple arithmetic, say increment a variable or
>> add some variables together? The manual implies that it is possible in a
>> filter but I want to do it outside of a filter.
>
>
> 2. Most if not all the mathematics functions in standard tiddlywiki are
> "filter operators", so they must be used in filters
>
> However;
>
> - Use triple braces to present the result of a calculation in line as
> a parameter.
> {{{ [your maths filter] }}} but you may need to turn the result into
> text <$text text={{{ [your maths filter] }}}/>
> - You can use other maths plugins like Evans formula plugin he uses
> Mushroom brackets (= maths =), calc widget and others
>
> In closing if you are reluctant to learn filters in more detail, I suggest
> you jump in. Filters are so powerful once you come to understand them your
> powers are almost unlimited.
>
> Regards
> TW Tones
>
> On Thursday, 10 September 2020 11:13:06 UTC+10, Bob Jansen wrote:
>>
>>
>>
>>
>>
>> bobj
>>
>>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/65ea8234-f9cb-4000-b738-dd5cb0db2693n%40googlegroups.com.