Gasolintable calculate

97 views
Skip to first unread message

Gerald Weis

unread,
Jan 9, 2020, 2:45:32 PM1/9/20
to TiddlyWiki
I have a table with that looks as follow










<table>
<tr>
<td>Date</td>
<td>mile-age</td>
<td>miles driven as the last refuel</td>
<td>Gallons refuel</td>
<td>Gallons up to 100 miles</td>
<td>Price total</td>
<td>Price for one Gallon</td>
</tr>
<tr>
<td>2019-12-14</td>
<td>10551</td>
<td>594</td>
<td>34.28</td>
<td>5.77</td>
<td>45.87</td>
<td>1.338</td>
</tr>






<td>2019-11-07</td>
<td>9957</td>
<td>692</td>
<td>35.40</td>
<td>5.11</td>
<td>47.37</td>
<td>1.338</td>
</tr>
</table>







now i want calculate

Miles driven as the last refuel
Gallons up to 100 Miles
Price for one Gallone

Any Ideas?

Thankyou for help













TonyM

unread,
Jan 9, 2020, 5:28:12 PM1/9/20
to TiddlyWiki
Gerald

Since this is a pure htmp table with literal values you would need a html solution which javascript is limited. If however the data was in tiddlers or fields you could use maths operators in filters to calculate the results.

Regards
tony

Mohammad

unread,
Jan 10, 2020, 12:03:00 AM1/10/20
to TiddlyWiki
You can store your data in a dataTiddler as index/value pair


The index here can be data and the value per each dataTiddler

Then use the simple mathematics operator in TW to perform desired calculations


Good luck

Gerald Weis

unread,
Jan 10, 2020, 4:17:07 AM1/10/20
to TiddlyWiki
thats is what i don



\define Benztab(Jahr)
<caption>Benzin $Jahr$</caption>
<thead align=left>
    <tr>
        <th>Datum</th>
        <th colspan=2>km</th>
        <th colspan=2>Liter</th>
        <th colspan=2>Preis</th>
    </tr>
    <tr>
        <th></th>
        <th>Stand </th>
        <th>gefahren </th>
        <th>getankt </th>
        <th>je 100 km </th>
        <th>gesamt </th>
        <th>je Liter </th>
    </tr>        
</thead>
\end

\define Benzkauf(Datum kmstand kmgefahren Litergetankt Literje100km Preisgesamt PreisjeLiter)
<tr align=right>
    <td>$Datum$</td>
    <td>$kmstand$</td>
    <td>$kmgefahren$</td>
    <td>$Litergetankt$</td>
    <td>$Literje100km$</td>
    <td>$Preisgesamt$ €</td>
    <td>$PreisjeLiter$ €</td>
</tr>
\end


<table>
<<Benztab "2019">>
<<Benzkauf "12.12.2019" "10551" "594" "34,28" "5,77" "45,87" "1,338">>
<<Benzkauf "07.11.2019" "9957" 692" "35,40" "5,11" "47,37" "1,338">>
</table>







PS: I'm using for this Wiki the version 5.19

thanks

Reply all
Reply to author
Forward
0 new messages