Would like to create a app that can do this.
Randomly select an event from a list (e,g, A plus 1, A minus 1, B plus 2, C minus 3)
After the event has been selected, call the value of A,B or C from tinyWebdb and execute the calculation.
Any advise please?
use the pick a random item block to pick a rando item from the list
then split the item using the split at spaces block to get another list
now select the first item (which is A, B or C) and use the TinyWebDB.GetValue block to get the value from TinyWebDB
in the TinyWebDB.GotValue block do the calculation
in the TinyWebDB.GotValue block do the calculation
the documentation is here
A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook http://www.appinventor.org/b ook2 ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks.
There is a free programming course here http://www.appinventor.or g/content/CourseInABox/Intro and the aia files for the projects in the book are here: http://www.appinventor.org/bo okFiles
How to do a lot of basic things with App Inventor are described here: http://www.appinventor.org/co ntent/howDoYou/eventHandling .
Also do the tutorials http://appinventor.mit.edu/ explore/ai2/tutorials.html to learn the basics of App Inventor, then try something and follow the
Top 5 Tips: How to learn App Inventor
You will not find a tutorial, which does exactly what you are looking for. But doing the tutorials (not only reading a little bit) help you to understand, how things are working. This is important and this is the first step to do.
Taifun
--
Hi Taifun,
Thanks but i think split at spaces does not solve the problem.
To clarify, from the random list, the "events" are all different. Perhaps i should give a better example.
For example in the list, the events are "Take the value of A and subtract from the value of B", "Add the value of C and the value of A", etc (12 other options)
Once the event has been randomly selected, for example "Add the value of C and the value of A", will need to go to Tiny webdb to getvalue of C and A followed by the addition.
I could do the If, do way for 14 times but was wondering if there are better ways.
Please help....
--
what about using 2 lists instead?
list 1 to display for the user:
Take the value of A and subtract from the value of BAdd the value of C and the value of A
...
list2:
B - A
C + A
...
and use list 2 for further processing?
use the selection index to get the corresponding item from the second list
and instead the pick a random item block use the random integer block instead to be able to work with the index, see also
Taifun
--
this looks like a completely different question?
some tips:
disable the clock for the test
use Do it to debug your blocks, see also tip 4 here
Taifun
--
Thanks.
one of the Do it result came back as
Do It Result: com.google.appinventor. components.runtime.Label@ 440c3a20
---
Does that mean there is an error in the code even though it is able to run but not getting the correct data?
--
you can't use Do it for local variables
See also Scott's tip How to use 'Do It' to view procedure results, event arguments and local variables.
Taifun
--