I'm trying to do some math using checkbox generated field values.
Using <<wikiCalc>> doesn't work:

{{{
[_(one@)] one
[_(two@)] two
[_(three@)] three
[_(four@)] four
[_(five@)] five

your score is <<wikiCalc "0+(%1*1)+(%2*1)+(%3*1)+(%4*1)+(%5*1)" "one@"
"two@" "three@" "four@" "five@">>
1+3 is <<wikiCalc "1+3">>
}}}

the above returns:
your score is Error in macro <<wikiCalc>>
1+3 is 4

presumably because the field values are true/false, not 1/0


using this:
{{{
<script>
var one=(store.getValue(tiddler,"one"))
var one2=parseInt(store.getValue(tiddler,"one"))
return one
return one2
</script>
}}}

gives the "true" when checked and "false" when not, but the
parseInt(...) doesn't convert it to 1/0 (its just blank)


Is there a straightforward way to use checkbox generated field values
to do simple math, or do I need some fancier scripting?

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.

Reply via email to