[tw5] Re: Hello TW world and calculation question

2021-02-23 Thread Charlie Veniot
Hey Brad, welcome to TiddlyWikiHood !!!

On Tuesday, February 23, 2021 at 12:21:46 PM UTC-4 brad.d...@gmail.com 
wrote:

> Hi everyone!
>
> I just discovered TiddlyWiki last week via a reddit post on using it to 
> organize D campaigns and was immediately struck by thousands of ideas all 
> at once for using it.
>
> I don't really have a coding background, though I have cobbled a few 
> macros together in excel. Since I have been very excel centric, I was 
> wondering how to do calculations and formulas in TW. At the moment I would 
> like to do the following:
>
> =INT(({{!!myfield}}-10)/2)
>
> I don't assume there is an INT() function, so I'm kind of stuck.
>
> Thanks in advance!
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/7ed8b14e-e1f4-484e-80e4-5998cc9b532an%40googlegroups.com.


[tw5] Re: Hello TW world and calculation question

2021-02-23 Thread Mat
Welcome Brad!

AFAICT, the INT function is the same as TiddlyWikis floor operator 
. (But 
floor also works on multiple numbers at once).

TW has quite a few math filter operators 
 if you didn't see 
them already.

<:-)

On Tuesday, February 23, 2021 at 9:01:44 PM UTC+1 brad.d...@gmail.com wrote:

> Thanks to both of you! I'll give these a try.
>
> On Tuesday, February 23, 2021 at 12:22:29 PM UTC-6 Ste wrote:
>
>> You might also try this plugin for a more excel like expeiance. 
>> https://chronicles.wiki/TiddlyWikiFormula/
>>
>> On Tuesday, 23 February 2021 at 16:39:29 UTC Eric Shulman wrote:
>>
>>> On Tuesday, February 23, 2021 at 8:21:46 AM UTC-8 brad.d...@gmail.com 
>>> wrote:
>>>
 ...how to do calculations and formulas in TW. At the moment I would 
 like to do the following:
 =INT(({{!!myfield}}-10)/2)

>>>
>>> Calculations are done using the "filter" syntax.  There are several ways 
>>> to do this.
>>>
>>> * direct rendering using "filtered transclusion"
>>> {{{ [{!!myfield}subtract[10]divide[2]trunc[]] }}}
>>>
>>> * using the $set widget with "filter" parameter
>>> <$set name="result" filter="[{!!myfield}subtract[10]divide[2]trunc[]]">
>>>
>>> * using the $vars widget with filtered transclusion as a parameter
>>> <$vars result={{{ [{!!myfield}subtract[10]divide[2]trunc[]] }}}>
>>>
>>> Notes:
>>> * within the filter syntax, field references use *single* curly braces.
>>> * there isn't any filter syntax for using parentheses in calculations, 
>>> so the order of operations is very important
>>> * sometimes this means using several filters to calculate intermediate 
>>> results and then combining them.
>>>
>>> For example, to calculate something like this:
>>> INT(({!!myfield} / 2) - ({!!myfield} - 5))
>>>
>>> You could write:
>>> <$vars part1={{{ [{!!myfield}divide[2]] }}} part2={{{ 
>>> [{!!myfield}subtract[5]] }}}>
>>> <$vars result={{{ [subtracttrunc[]] }}}
>>>
>>> enjoy,
>>> -e
>>>
>>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/e20e19f7-d216-4d9d-9b1d-0217b4fb8157n%40googlegroups.com.


[tw5] Re: Hello TW world and calculation question

2021-02-23 Thread Brad DeBruler
Thanks to both of you! I'll give these a try.

On Tuesday, February 23, 2021 at 12:22:29 PM UTC-6 Ste wrote:

> You might also try this plugin for a more excel like expeiance. 
> https://chronicles.wiki/TiddlyWikiFormula/
>
> On Tuesday, 23 February 2021 at 16:39:29 UTC Eric Shulman wrote:
>
>> On Tuesday, February 23, 2021 at 8:21:46 AM UTC-8 brad.d...@gmail.com 
>> wrote:
>>
>>> ...how to do calculations and formulas in TW. At the moment I would like 
>>> to do the following:
>>> =INT(({{!!myfield}}-10)/2)
>>>
>>
>> Calculations are done using the "filter" syntax.  There are several ways 
>> to do this.
>>
>> * direct rendering using "filtered transclusion"
>> {{{ [{!!myfield}subtract[10]divide[2]trunc[]] }}}
>>
>> * using the $set widget with "filter" parameter
>> <$set name="result" filter="[{!!myfield}subtract[10]divide[2]trunc[]]">
>>
>> * using the $vars widget with filtered transclusion as a parameter
>> <$vars result={{{ [{!!myfield}subtract[10]divide[2]trunc[]] }}}>
>>
>> Notes:
>> * within the filter syntax, field references use *single* curly braces.
>> * there isn't any filter syntax for using parentheses in calculations, so 
>> the order of operations is very important
>> * sometimes this means using several filters to calculate intermediate 
>> results and then combining them.
>>
>> For example, to calculate something like this:
>> INT(({!!myfield} / 2) - ({!!myfield} - 5))
>>
>> You could write:
>> <$vars part1={{{ [{!!myfield}divide[2]] }}} part2={{{ 
>> [{!!myfield}subtract[5]] }}}>
>> <$vars result={{{ [subtracttrunc[]] }}}
>>
>> enjoy,
>> -e
>>
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/0f8441f7-dd6e-4821-8214-c8b9e0abf9cbn%40googlegroups.com.


[tw5] Re: Hello TW world and calculation question

2021-02-23 Thread Ste
You might also try this plugin for a more excel like expeiance. 
https://chronicles.wiki/TiddlyWikiFormula/

On Tuesday, 23 February 2021 at 16:39:29 UTC Eric Shulman wrote:

> On Tuesday, February 23, 2021 at 8:21:46 AM UTC-8 brad.d...@gmail.com 
> wrote:
>
>> ...how to do calculations and formulas in TW. At the moment I would like 
>> to do the following:
>> =INT(({{!!myfield}}-10)/2)
>>
>
> Calculations are done using the "filter" syntax.  There are several ways 
> to do this.
>
> * direct rendering using "filtered transclusion"
> {{{ [{!!myfield}subtract[10]divide[2]trunc[]] }}}
>
> * using the $set widget with "filter" parameter
> <$set name="result" filter="[{!!myfield}subtract[10]divide[2]trunc[]]">
>
> * using the $vars widget with filtered transclusion as a parameter
> <$vars result={{{ [{!!myfield}subtract[10]divide[2]trunc[]] }}}>
>
> Notes:
> * within the filter syntax, field references use *single* curly braces.
> * there isn't any filter syntax for using parentheses in calculations, so 
> the order of operations is very important
> * sometimes this means using several filters to calculate intermediate 
> results and then combining them.
>
> For example, to calculate something like this:
> INT(({!!myfield} / 2) - ({!!myfield} - 5))
>
> You could write:
> <$vars part1={{{ [{!!myfield}divide[2]] }}} part2={{{ 
> [{!!myfield}subtract[5]] }}}>
> <$vars result={{{ [subtracttrunc[]] }}}
>
> enjoy,
> -e
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/0446db7f-7087-4550-841d-fbec938f937fn%40googlegroups.com.


[tw5] Re: Hello TW world and calculation question

2021-02-23 Thread Eric Shulman
On Tuesday, February 23, 2021 at 8:21:46 AM UTC-8 brad.d...@gmail.com wrote:

> ...how to do calculations and formulas in TW. At the moment I would like 
> to do the following:
> =INT(({{!!myfield}}-10)/2)
>

Calculations are done using the "filter" syntax.  There are several ways to 
do this.

* direct rendering using "filtered transclusion"
{{{ [{!!myfield}subtract[10]divide[2]trunc[]] }}}

* using the $set widget with "filter" parameter
<$set name="result" filter="[{!!myfield}subtract[10]divide[2]trunc[]]">

* using the $vars widget with filtered transclusion as a parameter
<$vars result={{{ [{!!myfield}subtract[10]divide[2]trunc[]] }}}>

Notes:
* within the filter syntax, field references use *single* curly braces.
* there isn't any filter syntax for using parentheses in calculations, so 
the order of operations is very important
* sometimes this means using several filters to calculate intermediate 
results and then combining them.

For example, to calculate something like this:
INT(({!!myfield} / 2) - ({!!myfield} - 5))

You could write:
<$vars part1={{{ [{!!myfield}divide[2]] }}} part2={{{ 
[{!!myfield}subtract[5]] }}}>
<$vars result={{{ [subtracttrunc[]] }}}

enjoy,
-e

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/5bcc9b37-c977-4865-b672-0e96dce2af5cn%40googlegroups.com.