Extracting arithmetical value of a field

154 views
Skip to first unread message

ParisWiki

unread,
Sep 23, 2016, 12:22:41 PM9/23/16
to TiddlyWiki
Hello,

I have some fields with numbers in them, ie {{!!field1}}=6 and {{!!field2}}=9,

Using <$calc>, I can add the artihmetic content of those two fields :  {{!!field3}}=<$calc>{{!!field1}} + {{!!field2}}</$calc>, which gives  me {{!!field3}}=15,

Now I want to extract the arithmetical value of {{!!field3}}, ie 15 and not $calc>{{!!field1}} + {{!!field2}}</$calc>, when I use in a form withing my wiki (formspree in my case to send back email for quizzes results).

I tried to define a variable "result" to do that, but I am unable to inject 15 in it. Neither $(result)$,  nor $<<field3>>$ nor some others gives 15 thru formspree but $calc>{{!!field1}} + {{!!field2}}</$calc>.

What am I missing to obtain the final math value of my field?

Thanx for your help,

JCG

Tobias Beer

unread,
Sep 23, 2016, 3:00:53 PM9/23/16
to TiddlyWiki
Hi JCG,

I believe the question you're really asking is: How to calculate iteratively?

Take a closer look at the tobibeer/eval filter.

Best wishes,

Tobias.

ParisWiki

unread,
Sep 24, 2016, 2:12:01 AM9/24/16
to TiddlyWiki
Wonderful Tobias !

It worked immediately out of the box (despite of its "dark hole"  aspect to me !)

Thank you so much,

JCG

Tobias Beer

unread,
Sep 24, 2016, 4:40:37 AM9/24/16
to TiddlyWiki
Hi JCG,
 
Wonderful Tobias !
It worked immediately out of the box 
(despite of its "dark hole"  aspect to me !)
Thank you so much,

I was mildly worried that figuring out how to actually use
the filter tobibeer/eval might be quite the challenge,
with constructs like a value variable and
other things to decipher the meaning of.

Now I'm quite happy to hear that
you've managed to work it out already.
That's terrific!

While there's a chance
that it may look slightly cryptic to others,
if you find the time, it would be great if
you could show us the eventual filter you defined,
and explain a little bit how it works exactly,
so others may appreciate a more hands-on example.

Best wishes,

Tobias.

ParisWiki

unread,
Sep 24, 2016, 7:09:56 AM9/24/16
to TiddlyWiki
OkTobias,

Let me finish to clean a little bit my mess, and I will put (hopefully this week end)  my last trilingual quiz online so one can peruse the inner guts of the beast, with, deep inside, the famous Eval filter by Tobibeer.
And for good mesure, a dash of your star Rating appendice.

Sincerely,
JCG

ParisWiki

unread,
Sep 24, 2016, 4:45:44 PM9/24/16
to TiddlyWiki
Here we are : http://b-l.neocities.org/Quiz/

This live Quiz uses Tobias Beer's Rating pluging on the before last tiddler.

And also the more cryptic, but powerful Eval filter, in the last tiddler, wihich is the interface between the quiz and the form to send the result by mail.

See :
<$set name="foo" filter="[[]eval[{{Q1!!r1}}+{{Q2!!r2}}+{{Q3!!r3}}+{{Q4!!r4}}+{{Q5!!r5}}]]">
<input type="hidden" name="_subject" value=<<foo>> />
</$set>

This formula gives the total result of the different questions directly to the mailing process.

At the bottom of this tiddler you can add your email if you want to see the details of  your notes to the different questions.
<!-- input type="hidden" name="_cc" value="you...@yourmail.com" / -->

Sincerely,

JCG

Tobias Beer

unread,
Sep 25, 2016, 12:38:12 PM9/25/16
to TiddlyWiki
Hi JCG,
Nice, but it looks like it's rather easy to cheat :D

Best wishes,

Tobias.

ParisWiki

unread,
Sep 25, 2016, 1:40:47 PM9/25/16
to TiddlyWiki
Tobias,
To you and for some members of the Tiddlywiki community, this quiz, as I left ,for your perusal, the edit button active, you are right that it may easy to cheat.

But in real life, without any button accessible, when you take a tasting course outside of your home (a restaurant, a wine domain etc) and the only tool you have is your smarphone, and the first guy  who answers correctly wins, we strongly believe that opening the code source, finding the questions and the rules used in it is much too long and unreadable for non geek people.

You are quite optimistic about the percentage of people in the world able to recognize Tiddlywiki structure and to navigate easily in a file wihich is more than 5 GO long and partly encrypted.

And by the way,  please tell me how you call control -U on your smartphone, because we don't.

Lastly, we don't deal with business secrets, personal data or state confidential matters. It is a game, just a test to see if you enjoyed your tasting and remember what you were supposed to listen to.

Sincerely,
JCG
Reply all
Reply to author
Forward
0 new messages