Is it possible to pass the value from a tiddler to a field?

176 views
Skip to first unread message

Ste Wilson

unread,
Jun 18, 2017, 1:42:03 PM6/18/17
to TiddlyWiki
So the value in a tiddler in view mode is "foo" and has been generated by various black magic leak growing arts, filters, widgets and cats.
I need to pass this static value into a field. Not the dynamic changing value of foo.

At least I think that's what I need. Is it possible?

Thanks in advance.

Mark S.

unread,
Jun 18, 2017, 3:48:22 PM6/18/17
to TiddlyWiki
I think to give you a workable answer we need to know more about your use case. Various animal cruelty laws for instance, make certain cat-based magic macros illegal almost everywhere except in countries with names ending in "-vania"

Do want the entire contents of the tiddler transferred somewhere, and if so do you want to have a button to do the transfer? If you want it to happen right after the magic whatever then we need to know more about the whatever.

Good luck --
Mark

Jed Carty

unread,
Jun 18, 2017, 3:59:23 PM6/18/17
to TiddlyWiki
This sounds like a job for the wikify widget. If you give it whatever magic (or a transclusion that shows the result of the magic) it should return the result as a variable that you can use in an action widget.

Ste Wilson

unread,
Jun 19, 2017, 9:28:25 AM6/19/17
to TiddlyWiki
I'll go have a look at the wikifi widget then I'll no doubt be back and will fill out the details.

Cheers!

Stephen Wilson

unread,
Jun 30, 2017, 6:56:33 AM6/30/17
to TiddlyWiki
Ok...
I have looked at the wikify widget, then I looked some more...then I tried to find some examples....then I looked confused...

Right...so the full story.

I am using 
\define mylatex(a,b)
<$wikify name="doit" text="""
<$latex text="
{$a$}+{$b$}" displayMode="true"></$latex>""" >
<<doit>>
</$wikify>
\end


<$macrocall $name="mylatex" a=<<eval1 datatiddler:"data" cell:"random3">>  b=<<eval1 datatiddler:"data" cell:"random4">>  >
To put a random value into a LaTeX equation (via the KaTeX plugin).

The random number is generated by 
=@floor((@random() * 10) + 1)
and the eval1 macro is from the mathcell plugin.

So far so good.  Unfortunately, at every update the random number changes and a different random number is generated for each tiddler that uses the above code.
In an ideal world, I would want the SAME random number sent to multiple tiddlers.

This leads me to my problem.  

1. I need to generate a random number which I can then insert into an equation. DONE.
2. Student reads equation and submits answer.
3. Answer is compared to a list (generated by me) of 'correct' or 'nearly' answers and appropriate feedback given.

So if I generate the random numbers into their own tiddlers and then take the number displayed in that tiddler back into another field just containing that plain number I can then transclude that into my latex and also perform more eval1 functions on it to generate answers which can then be compared to student imput also using the eval1 macro....

How hard can it be?  *sobs*...

Regards

Stephen

Stephen Wilson

unread,
Jun 30, 2017, 6:59:56 AM6/30/17
to TiddlyWiki
So the final part might look  a little like: http://stephenteachertests.tiddlyspot.com/#Mathcell%20testing

Mark S.

unread,
Jun 30, 2017, 9:45:07 AM6/30/17
to TiddlyWiki
It seems to me that you need a button  to generate random numbers somewhere at the top of your testing process. The button would populate whatever random cells you want at the start. Then the rest of your test questions would draw from from those cells. That way the random process only occurs once and nothing changes as tiddlers are refreshed.

As a side thought, if you had a start and stop button, then you could also save timestamps and see how long it too to complete the test.

Mark

Stephen Wilson

unread,
Jun 30, 2017, 10:12:58 AM6/30/17
to TiddlyWiki
Timestamp....arrrghhhhhh....tooo much! :) (good idea)

So it may be my random number generation method..as I say currently I can't get a static random number.

Mat

unread,
Jun 30, 2017, 11:20:49 AM6/30/17
to TiddlyWiki
I didn't read the details of your case above but just to make sure you've tried this:

<$wikify name=myvalue text={{sometiddler}} >
<$button>
<$action-setfield $tiddler="..." $field=... text=<<myvalue>> />
set
</$button>
</$wikify>


<:-)

Mark S.

unread,
Jun 30, 2017, 12:28:01 PM6/30/17
to TiddlyWiki
This uses eval instead of your wrapper eval1. The button sets data cells STATIC_RAN_01 and STATIC_RAN_02 to a random value. You can of course set up as many static fields as you're going to need for your testing.

<$button>Set randoms
<$action-setfield $tiddler="data" $field="STATIC_RAN_01" $value=
<
<eval datatiddler:"data" cell:"random1">>/>
<$action-setfield $tiddler="data" $field="STATIC_RAN_02" $value=
<
<eval datatiddler:"data" cell:"random1">>/>
</$button>


Mark

Ste Wilson

unread,
Jun 30, 2017, 3:14:36 PM6/30/17
to TiddlyWiki
You make it look so easy...
Reply all
Reply to author
Forward
0 new messages