HOW TO USE MATH MACRO WITH FIELDS:

As with the calculator tiddler, the macro can be used with variables for 
input from other sources.


<ragscalculator $(num1variable)$ $(operatorvariable)$ $(num2variable)$>> 


macro with values 32, 64 typed in: 


<<ragscalculator2 32 add 64>>


= 96


values 32, 64 read from fields: 


<$set name="n1var" value={{!!filter-field1}}>
<$set name="n2var" value={{!!filter-field2}}>
<<ragscalculator2 $(n1var)$ add $(n2var)$>>
</$set></$set>


96 


macro in a list generating a table, reading values from fields: 


<table>
<tr><th></th><th>field 1</th><th>field 2</th><th>macro output</th></tr>
<$list filter="[prefix[zz test pg]]">
<$set name="n1var" value={{!!filter-field1}}>
<$set name="n2var" value={{!!filter-field2}}>
<tr><td>{{!!title}}</td><td>{{!!filter-field1}}</td><td><$view 
field="filter-field2"/></td>
<td><<ragscalculator2 $(n1var)$ add 
$(n2var)$>></td></tr></$set></$set></$list></table>


field 1field 2macro output 
zz test pg1 12 24 36 
zz test pg2 27 18 45 
zz test pg3 72 18 90 
zz test pg4 
11 11 
zz test pg5 -5 -25 -30 
zz test pg6 12 -12 0


To expand this for exponents, ie: 4 to the 4th power, a macro 


<<tothepower basenumber multiply powernumber>>


could take "basenumber" (four) for both numbers in a multiply filter, save 
the result to a field/variable to insert into another multiply filter using 
the variable for both numbers of the filter, repeating "powernumber" number 
of steps.

-- 
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/e1bf4b0a-4f64-44f3-b9c6-8222fd61e374%40googlegroups.com.

Reply via email to