Skip to first unread message

camer...@gmail.com

unread,
Aug 20, 2014, 2:20:06 PM8/20/14
to mitappinv...@googlegroups.com
Okay, I have a screen with 10 spinners, where you can select one of six options, how do I make a if statement using the data selected in the spinner, specifically:

if spinner1 = choice1 then do .........

Enis

unread,
Aug 20, 2014, 2:34:30 PM8/20/14
to mitappinv...@googlegroups.com
What have you tried so far?

Stephen Zipprich

unread,
Aug 20, 2014, 7:15:06 PM8/20/14
to mitappinv...@googlegroups.com
Okay, I have a screen with 10 spinners, where you can select one of six options, how do I make a if statement using the data selected in the spinner, specifically:

if spinner1 = choice1 then do .........

Honestly, this is some of the most basic of coding you can do in App Inventor...which is why I want to ask have you done the tutorials to learn about how App Inventor works?

Also, see Enis' question. 

camer...@gmail.com

unread,
Aug 22, 2014, 9:10:44 AM8/22/14
to mitappinv...@googlegroups.com
Going to the tutorials gives a "no data received" message, thats why I post here. Also, I have a new idea, stop me if I'm wrong

Then on another screen

The 2 things that I don't understand is what goes in the thing part of Is a list? and how to read the information, in order in the then part of a if statement. If there is a better way of reading the information from 10 different spinners on one screen to another, then displaying that information on the 2nd screen then please tell me.




Taifun

unread,
Aug 22, 2014, 9:43:55 AM8/22/14
to mitappinv...@googlegroups.com
to initialize a list, you should use the create empty list block instead of an empty text block
it does not make sense to store a list of spinner components in TinyDB, do you want to store their values instead?

what goes in the thing part of Is a list?

is a list?

If thing is a list, returns true; otherwise, returns false.


if is a list get global listOne


first do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.html to learn the basics of App Inventor and follow the
 Top 5 Tips: How to learn  App Inventor

Taifun

Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by Taifun.         


camer...@gmail.com

unread,
Aug 22, 2014, 10:38:07 AM8/22/14
to mitappinv...@googlegroups.com
it does not make sense to store a list of spinner components in TinyDB, do you want to store their values instead?

yes, hat is exactly what i need to do, how do I do that.

Taifun

unread,
Aug 22, 2014, 11:21:50 AM8/22/14
to mitappinv...@googlegroups.com
let's take a look together at the documentation http://ai2.appinventor.mit.edu/reference/components/userinterface.html#Spinner

as you can see, you get the value of a spinner in the AfterSelection event. the value is Spinner.Selection

Spinner are similar to listpicker, have you already done the tutorials?
if not, now is the time to do them, see also 

camer...@gmail.com

unread,
Aug 22, 2014, 3:25:54 PM8/22/14
to mitappinv...@googlegroups.com
okay, this is what i have so far

so I think i am getting the values, is tinyDB the only way to store information from 1 screen to another. Basically, here is what I want to do

get the value of the 10 different spinners (which will be 1 through 6 as designated in the elementsFromString)

take those values to another screen

Everytime the user presses a button the next value appears (ergo *presses button* One *presses button* Four *presses button* Three...)


Taifun

unread,
Aug 22, 2014, 4:00:36 PM8/22/14
to mitappinv...@googlegroups.com
I would store the values in a list and the list in only one tag in TinyDB instead of using 10 different tags 
How to work with Lists by Saj

to pass values to another screen you can use TinyDB (just store the list in TinyDB first) or pass the list directly using the open another screen with value block

Taifun

camer...@gmail.com

unread,
Aug 28, 2014, 2:43:00 PM8/28/14
to mitappinv...@googlegroups.com
Thankyou for all the help, the probleam is nearly fixed. However when I try to read the spinner value i get a long error message instead of the value

com.google.appinventor.components.runtime.Spinner@4224b188

I think the problem is in this code, and the one post that I could find looked like this, but was in AI1, so I don't know if I have to do something different in 2 or not. Thanks in advance.


camer...@gmail.com

unread,
Aug 28, 2014, 3:01:24 PM8/28/14
to mitappinv...@googlegroups.com
I AM SUCH AN IDIOT.

fixed the problem, thanks for all the help and putting up with my stupid questions :p
Reply all
Reply to author
Forward
0 new messages