[tw] Re: How to calculate (sum, avg) with fields and store the result in an other field?

2017-08-10 Thread Thomas Elmiger
Hi Uwe

Try this structure to sum 4 fields in 1 macrocall:

<$macrocall $name="rpn" a=<> b=<> operation="+"/>

Hint: in the shortcut <> the tiddler from where to get the field 
value must be specified in the transclusion.

All the best, 
Thomas

Am Dienstag, 8. August 2017 16:28:44 UTC+2 schrieb Uwe:
>
> So I have tried this with Thomas Elmigers rpn plugin, found here:
> https://tid.li/tw5/plugins.html
> https://tid.li/tw5/hacks.html#rpnTest
>
>
> <$macrocall $name="rpn" a={{!!field1}} b={{!!field2}} operation="+" 2/>
>
> <$macrocall $name="rpn" a={{!!field3}} b={{!!field4}} operation="+" 2/>
>
> It is also not possible to add more than 2 fields in a macrocall.
>
 
Well, as demonstrated, it IS possible, but not very intuitive ;–) 
And: I would not recommend to try to add another level – the code gets too 
complicated. So 4 operands would be the limit.

-- 
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 post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/fbcfeddb-e0b4-4fac-8b8d-8a5c69826d98%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: How to calculate (sum, avg) with fields and store the result in an other field?

2017-08-08 Thread Mat
Uwe wrote:
>
> So I have tried this with Thomas Elmigers rpn plugin, 
>

> But how can I add the results of each of these expressions? (Has it 
> something to do with the listwidget you mentioned?)
>

Yes,  listwidget. I have not tried it so I may miss something fundamental 
but, basically, you'd iterate through the arguments recursively using the 
rpn to calculate "up til now" along the way. I'm a bit unsure of how to 
handle parentheses but spontaneously I'd think the first listwidget 
filtering must be to split out such sub-statements (i.e surrounded with 
parentheses) and then do the iteration with the rpn on it's contents. If 
you could accept statements without parentheses, I think it would be more 
direct and simpler. Regardless; if you have limited experience with filter 
operators in TW... then I guess you have some fun ahead of you ;-) ...BUT, 
as noted, I don't think it would make for an effective solution given that 
there surely are optimized js calculators that can(?) be 'tiddlified'.

<:-)

-- 
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 post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/ca168494-66eb-4dde-8944-2ec5bd7d246d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: How to calculate (sum, avg) with fields and store the result in an other field?

2017-08-08 Thread 'Mark S.' via TiddlyWiki
A different approach would be to use mathcell 
(http://mathcell.tiddlyspot.com/) that emulates spreadsheet-like abilities.

Good luck,
Mark

On Wednesday, August 2, 2017 at 1:05:14 PM UTC-7, Uwe wrote:
>
> Hello dear helpers,
>
> in some tiddlers I have some (< 20) fields with numbers in them, ie 
> {{!!field1}}=2, {{!!field2}}=4 and {{!!field3}}=5 and so on.
>
> I imported $:/plugins/mklauber/math.js 
> 
>  
> from http://mklauber.github.io/tiddly-mathjs/
>
> Using <$calc>, I *cannot *add the sum of these three fields  
> {{!!field4}}=<$calc>{{!!field1}} + {{!!field2}} + {{!!field3}} into 
> field4.
> What went wrong?
>
> I need a solution for automatically calculating with the values of my 
> fields (+, -, *, :, percent, average) and to store the result in an other 
> named field. Is there such a solution out there? (Statistical values 
> calculated about all tiddlers with these fields would be great.)
>
> The use case is to calculate the average points of students they got in 
> some tests (and to get the average of all students).
>
> Greetings,
>
> Uwe
>
>
>
>
>
>

-- 
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 post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/0b4eaccb-84b6-4dbd-b313-9eb27bd3c48e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: How to calculate (sum, avg) with fields and store the result in an other field?

2017-08-08 Thread Uwe
So I have tried this with Thomas Elmigers rpn plugin, found here:
https://tid.li/tw5/plugins.html
https://tid.li/tw5/hacks.html#rpnTest


<$macrocall $name="rpn" a={{!!field1}} b={{!!field2}} operation="+" 2/>

<$macrocall $name="rpn" a={{!!field3}} b={{!!field4}} operation="+" 2/>

It is also not possible to add more than 2 fields in a macrocall.

But how can I add the results of each of these expressions? (Has it 
something to do with the listwidget you mentioned?)

Perhaps anyone has an idea for a completely other solution of the problem 
(see first post). [Please not: An external link to an Excel spreadsheet ;-)]






Am Dienstag, 8. August 2017 13:09:54 UTC+2 schrieb Mat:
>
> Uwe wrote:
>  
>
>> Automatically calculating values in the fields and in the tiddler like 
>> this example would be a great simplification:
>>
>> {{!!schnitt}}=({{!!field1}}+{{!!field2}}+{{!!field3}}+{{!!field4}})/4
>>
>  
>
> While it's not direct (i.e not optimized), it should not be overly 
> difficult to make a macro with a listwidget and the argument "( field1 + 
> field2 + field3 + field4 ) / 4" and iterates through this to pairwise (i.e 
> two numbers and one operator at a time) apply one of the existing 
> calculators (e.g Thomas Elmigers rpn plugin). 
>
> But then, there must be a *zillion* great js calculators that could just 
> be wrapped up as a TW plugin (...he said confidently without having ever 
> made a js plugin)
>
> <:-)
>

-- 
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 post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/df4f3904-b933-46c1-9625-d95f8497e68e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: How to calculate (sum, avg) with fields and store the result in an other field?

2017-08-08 Thread Mat
Uwe wrote:
 

> Automatically calculating values in the fields and in the tiddler like 
> this example would be a great simplification:
>
> {{!!schnitt}}=({{!!field1}}+{{!!field2}}+{{!!field3}}+{{!!field4}})/4
>
 

While it's not direct (i.e not optimized), it should not be overly 
difficult to make a macro with a listwidget and the argument "( field1 + 
field2 + field3 + field4 ) / 4" and iterates through this to pairwise (i.e 
two numbers and one operator at a time) apply one of the existing 
calculators (e.g Thomas Elmigers rpn plugin). 

But then, there must be a *zillion* great js calculators that could just be 
wrapped up as a TW plugin (...he said confidently without having ever made 
a js plugin)

<:-)

-- 
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 post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/2d4e6f85-a9e3-4d9a-b08f-f30e122eaf26%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: How to calculate (sum, avg) with fields and store the result in an other field?

2017-08-08 Thread Uwe
I totally agree.

Nonetheless, thanks to any contribution to this issue, maybe it helps 
others.

Here is the solution, I made:


<$fieldmangler>
  <$list filter="[is[current]tag[Aktiv]]">
<$button message="tm-remove-tag" param="Aktiv">Aktiv
  
  <$list filter="[is[current]!tag[Aktiv]]">
<$button message="tm-add-tag" param="Aktiv">Aktiv
  

<$fieldmangler>
  <$list filter="[is[current]tag[m]]">
<$button message="tm-remove-tag" param="m">m
  
  <$list filter="[is[current]!tag[m]]">
<$button message="tm-add-tag" param="m">m
  

<$fieldmangler>
  <$list filter="[is[current]tag[w]]">
<$button message="tm-remove-tag" param="w">w
  
  <$list filter="[is[current]!tag[w]]">
<$button message="tm-add-tag" param="w">w
  

<$fieldmangler>
  <$list filter="[is[current]tag[FW51]]">
<$button message="tm-remove-tag" param="FW51">FW51
  
  <$list filter="[is[current]!tag[FW51]]">
<$button message="tm-add-tag" param="FW51">FW51
  

<$fieldmangler>
  <$list filter="[is[current]tag[FW61]]">
<$button message="tm-remove-tag" param="FW61">FW61
  
  <$list filter="[is[current]!tag[FW61]]">
<$button message="tm-add-tag" param="FW61">FW61
  

<$fieldmangler>
  <$list filter="[is[current]tag[FW71]]">
<$button message="tm-remove-tag" param="FW71">FW71
  
  <$list filter="[is[current]!tag[FW71]]">
<$button message="tm-add-tag" param="FW71">FW71
  

<$fieldmangler>
  <$list filter="[is[current]tag[Facharbeit]]">
<$button message="tm-remove-tag" 
param="Facharbeit">Facharbeit
  
  <$list filter="[is[current]!tag[Facharbeit]]">
<$button message="tm-add-tag" param="Facharbeit">Facharbeit
  



{{!!title}}

[[Wirtschaftsinformatik]]

US01 KA01 + KA02: <$edit-text field='fw51-wi-ka01' size=2/> + <$edit-text 
field='fw51-wi-ka02' size=2/> = {{!!fw51-wi-ka1u2}}
US02 KA03 + KA04: <$edit-text field='fw51-wi-ka03' size=2/> + <$edit-text 
field='fw51-wi-ka04' size=2/> = {{!!fw51-wi-ka3u4}}
//= {{!!fw51-wi-ka1b4}} Punkte Zwischenzeugnis// 

MS01 KA05 + KA06: <$edit-text field='fw51-wi-ka05' size=2/> + <$edit-text 
field='fw51-wi-ka06' size=2/> = {{!!fw51-wi-ka5u6}} 
= ''{{!!fw51-us-os-wi-summe}}'' Punkte Abschlusszeugnis

Päd. Punkte Abschlusszeugnis WI: <$edit-text 
field='fw51-wi-zeugnis_abschluss' size=2/>

<$button>WI: Aktualisieren und Speichern
<$action-sumfield2 $filter='[tag[FW51]]' $sumfield='fw51-wi-ka01' 
$sumfield2='fw51-wi-ka02' $storefield='fw51-wi-ka1u2'/>
<$action-sumfield2 $filter='[tag[FW51]]' $sumfield='fw51-wi-ka03' 
$sumfield2='fw51-wi-ka04' $storefield='fw51-wi-ka3u4'/>
<$action-sumfield2 $filter='[tag[FW51]]' $sumfield='fw51-wi-ka1u2' 
$sumfield2='fw51-wi-ka3u4' $storefield='fw51-wi-ka1b4'/>
<$action-sumfield2 $filter='[tag[FW51]]' $sumfield='fw51-wi-ka05' 
$sumfield2='fw51-wi-ka06' $storefield='fw51-wi-ka5u6'/>
<$action-sumfield2 $filter='[tag[FW51]]' $sumfield='fw51-wi-ka1u2' 
$sumfield2='fw51-wi-ka3u4' $storefield='fw51-us-wi-summe'/>
<$action-sumfield2 $filter='[tag[FW51]]' $sumfield='fw51-us-wi-summe' 
$sumfield2='fw51-wi-ka5u6' $storefield='fw51-us-os-wi-summe'/>


---

{{!!title}}

[[Controlling]]

MS02 KA01 + KA02: <$edit-text field='fw51-ctr-ka01' size=2/> + <$edit-text 
field='fw51-ctr-ka02' size=2/> //= {{!!fw51-ctr-ka1u2}} Punkte 
Zwischenzeugnis// 

OS01 KA03 + KA04: <$edit-text field='fw51-ctr-ka03' size=2/> + <$edit-text 
field='fw51-ctr-ka04' size=2/> = {{!!fw51-ctr-ka3u4}} 
= ''{{!!fw51-ctr-summe}}'' Punkte Abschlusszeugnis

Päd. Punkte Abschlusszeugnis CTR: <$edit-text 
field='fw51-ctr-zeugnis_abschluss' size=2/>

<$button>CTR: Aktualisieren und Speichern
<$action-sumfield2 $filter='[tag[FW51]]'| $sumfield='fw51-ctr-ka01' 
$sumfield2='fw51-ctr-ka02'| $storefield='fw51-ctr-ka1u2'/>
<$action-sumfield2 $filter='[tag[FW51]]'| $sumfield='fw51-ctr-ka03' 
$sumfield2='fw51-ctr-ka04'| $storefield='fw51-ctr-ka3u4'/>
<$action-sumfield2 $filter='[tag[FW51]]'| $sumfield='fw51-ctr-ka1u2' 
$sumfield2='fw51-ctr-ka3u4'| $storefield='fw51-ctr-summe'/>


And this is the (button based) solution only for adding the percentage 
based points, not for the points themselves, not for the grades.

Automatically calculating values in the fields and in the tiddler like this 
example would be a great simplification:

{{!!schnitt}}=({{!!field1}}+{{!!field2}}+{{!!field3}}+{{!!field4}})/4

To comfortably calc with (more than two) fields is often needed. Perhaps 
some day a developer will see this problem and solve it. Let me know. ;-)

Greetings,

Uwe


Am Mittwoch, 2. August 2017 22:21:07 UTC+2 schrieb @TiddlyTweeter:
>
> Welcome to the club of non-functioning math in TW.
>
> Its a mess of half solutions.
>
> Josiah
>
>
> Uwe wrote:
>>
>> in some tiddlers I have some (< 20) fields with numbers in them, ie 
>> {{!!field1}}=2, {{!!field2}}=4 and {{!!field3}}=5 and so on.
>>
>> I imported $:/plugins/mklauber/math.js 
>> 
>>  
>> from http://mklauber.github.io/tiddly-mathjs/
>>
>> Using <$calc>, I *cannot 

[tw] Re: How to calculate (sum, avg) with fields and store the result in an other field?

2017-08-04 Thread Matthew Lauber
The issue is that the assignment doesn't work like that.  You can't assign 
to a field like that, regardless of whether it's math or text or anything 
else.  The equals sign is just another letter when it's used in html. 
 You'd probably need to play around with macros and the <$action-setfield> 
widget to get what you want to happen. AS you can see in your example. The 
<$calc> widget did add the two fields together resulting in the 8 you see 
in the example.

Matt Lauber

On Wednesday, August 2, 2017 at 4:05:14 PM UTC-4, Uwe wrote:
>
> Hello dear helpers,
>
> in some tiddlers I have some (< 20) fields with numbers in them, ie 
> {{!!field1}}=2, {{!!field2}}=4 and {{!!field3}}=5 and so on.
>
> I imported $:/plugins/mklauber/math.js 
> 
>  
> from http://mklauber.github.io/tiddly-mathjs/
>
> Using <$calc>, I *cannot *add the sum of these three fields  
> {{!!field4}}=<$calc>{{!!field1}} + {{!!field2}} + {{!!field3}} into 
> field4.
> What went wrong?
>
> I need a solution for automatically calculating with the values of my 
> fields (+, -, *, :, percent, average) and to store the result in an other 
> named field. Is there such a solution out there? (Statistical values 
> calculated about all tiddlers with these fields would be great.)
>
> The use case is to calculate the average points of students they got in 
> some tests (and to get the average of all students).
>
> Greetings,
>
> Uwe
>
>
>
>
>
>

-- 
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 post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/adcb2e66-a2d4-4202-bfc9-1d8c626affe0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: How to calculate (sum, avg) with fields and store the result in an other field?

2017-08-03 Thread Thomas Elmiger
I have some links and minimalist comments in my own half solution here, at the 
end of the readme: 
https://tid.li/tw5/plugins.html#%24%3A%2Fplugins%2Ftelmiger%2Frpn

No average function available here. 

All the best,
Thomas 

-- 
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 post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/8b34d13d-a97a-41a9-a4ed-3749f27251b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: How to calculate (sum, avg) with fields and store the result in an other field?

2017-08-03 Thread Danielo Rodríguez
Sorry Josiah, I was on my mobile phone and the link was not easily reachable 
from here. Luckily someone has already posted the links. Both are very good 
plugins for math 

-- 
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 post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/75c2edea-6238-47fb-a8ba-359f726658e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: How to calculate (sum, avg) with fields and store the result in an other field?

2017-08-02 Thread 'Mark S.' via TiddlyWiki
Probably 

https://tobibeer.github.io/tb5/#calc

or 

https://tobibeer.github.io/tw5-plugins/#eval

Mark

On Wednesday, August 2, 2017 at 2:13:16 PM UTC-7, @TiddlyTweeter wrote:
>
> Right. Its at:  Where?
>
> I hate we can't find anything when we need it.
>
> Danielo Rodríguez wrote:
>>
>> Tobías has a good plugin for math 
>
>

-- 
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 post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/2ac2e139-0406-4bfb-8cca-1c1e8d36777e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: How to calculate (sum, avg) with fields and store the result in an other field?

2017-08-02 Thread @TiddlyTweeter
Right. Its at:  Where?

I hate we can't find anything when we need it.

Danielo Rodríguez wrote:
>
> Tobías has a good plugin for math 

-- 
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 post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/833f98d0-cdec-4053-9e1b-38296bcfd6e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: How to calculate (sum, avg) with fields and store the result in an other field?

2017-08-02 Thread Danielo Rodríguez
Tobías has a good plugin for math 

-- 
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 post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/36d42131-9eb0-46d9-9e5d-301254de7fd8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: How to calculate (sum, avg) with fields and store the result in an other field?

2017-08-02 Thread @TiddlyTweeter
Welcome to the club of non-functioning math in TW.

Its a mess of half solutions.

Josiah


Uwe wrote:
>
> in some tiddlers I have some (< 20) fields with numbers in them, ie 
> {{!!field1}}=2, {{!!field2}}=4 and {{!!field3}}=5 and so on.
>
> I imported $:/plugins/mklauber/math.js 
> 
>  
> from http://mklauber.github.io/tiddly-mathjs/
>
> Using <$calc>, I *cannot *add the sum of these three fields  
> {{!!field4}}=<$calc>{{!!field1}} + {{!!field2}} + {{!!field3}} 
> into field4.
> What went wrong?
>

-- 
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 post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/65e7cec5-827d-400a-9f8d-a299e9adbac1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.