Unable to link one table values to other and validate the login

1,807 views
Skip to first unread message

Srilakshmi N

unread,
Feb 6, 2016, 12:57:57 PM2/6/16
to MIT App Inventor Forum
I was trying to create an app which has login template for it, before that the user signs up using d signup screen.. In order to map the login and signup details, I was trying to match the values entered in signup and login page.. Getting too many errors. Any help will be appreciated.
Thank you.
blocks.png
Screenshot_2016-02-06-23-15-51.png
Screenshot_2016-02-06-23-15-41.png

Taifun

unread,
Feb 6, 2016, 1:59:20 PM2/6/16
to MIT App Inventor Forum
see my answer here https://groups.google.com/d/msg/mitappinventortest/SSFZwNUrVGU/-uS3oPtPWrgJ

and: do not use the GetRowsWithCondition and the SendQuery block together
your sql statement must be created only using text blocks
the NumbersOnly property returns true or false, if you want to get the text of a textbox (which also can be a number in your case), use the Text property instead
there should be no other block after the GetRowsWithCondition block, you should do all the further processing in the FusiontablesControls.GotResult event

Taifun

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



Srilakshmi N

unread,
Feb 7, 2016, 2:54:57 AM2/7/16
to MIT App Inventor Forum
Hey Taifun,
I tried as per ur suggestion, but I'm now getting an error in the send query. I've modified the fusiontables.gotresult also.
Please help.
blocks(1).png
Screenshot_2016-02-07-13-17-41.png

Srilakshmi N

unread,
Feb 7, 2016, 4:07:58 AM2/7/16
to MIT App Inventor Forum
Here's the latest verison of the blocks and error, do hv a look at it
blocks(2).png
Screenshot_2016-02-07-14-29-26.png

Taifun

unread,
Feb 7, 2016, 9:11:54 AM2/7/16
to mitappinv...@googlegroups.com
as already said in the other thread, these are the recommended steps
a user enters name and password into a textbox
then send a select statement like this: SELECT password FROM <tableid> WHERE user = 'user name entered in user name textbox'

 
now in the FusiontablesControl.GotResult event you can check the result:
1. if there is no row returned, i.e. the user name does not exist in the table, print an error message "user does not exist"
2. if a row was returned, now check, if the returned password is equal to the password entered in the password textbox
if no, print error message "password is wrong"


 

btw. normally it's not a good idea to store plain passwords in a table, a better solution is to create a hash value and compare the hash values then


currently you only get the header row back from the table and no data row, because there obviously is no mobile phone number available in your table, which is "get global mobile"... 
what about using the join block and join the text property of the textbox instead, same with the password?
also use Do it to find out, how your select statement looks like you are sending to the table, see also

Taifun


Edit: 2 screenshots added for recommended solution 

Srilakshmi N

unread,
Feb 7, 2016, 9:30:44 AM2/7/16
to MIT App Inventor Forum
the data is already there.. I hv created a signup page which will allow user to enter their name email mobile and password.. I want to compare if d number exists in that table and if d pwd matches with it, then allow the user to login.
Message has been deleted
Message has been deleted

Taifun

unread,
Feb 7, 2016, 10:09:19 AM2/7/16
to mitappinv...@googlegroups.com
here is your fish
a complete login example using a fusiontable as simple as possible
Taifun


Srilakshmi N

unread,
Feb 7, 2016, 10:14:59 AM2/7/16
to MIT App Inventor Forum
Thank you, I'll check it and get back to u in 10mins :)

Srilakshmi N

unread,
Feb 7, 2016, 10:32:25 AM2/7/16
to MIT App Inventor Forum
Hi Taifun,
The code is working perfect, but its showing user not registered even though the values are in the table.. So i didn't understand how the values are going to get inserted into the list. I've done exactly as u hv sent!!

blocks(5).png
Screenshot_2016-02-07-21-00-39.png

Srilakshmi N

unread,
Feb 7, 2016, 11:26:05 AM2/7/16
to MIT App Inventor Forum
I would like to know if there's a way to send verification from mit ai2 when the user signs up, so as to validate the mobile number??

Taifun

unread,
Feb 7, 2016, 11:27:18 AM2/7/16
to MIT App Inventor Forum
as already said, use Do it to debug your blocks, especially your SQL statement and the result in listResult
probably there are spaces in the textbox?
Taifun


Srilakshmi N

unread,
Feb 7, 2016, 11:32:21 AM2/7/16
to MIT App Inventor Forum
Yes, it shows an error saying cannot remove items fro list since it's empty. How do I populate the list, with the values in my sign up table?

Taifun

unread,
Feb 7, 2016, 11:32:34 AM2/7/16
to MIT App Inventor Forum
I would like to know if there's a way to send verification from mit ai2 when the user signs up, so as to validate the mobile number??
probably my Telephony Manager Extension can help ...

The App Inventor Extensions are currently in testing. See the announcement for more information about how to use an App Inventor Extension. 

Taifun         

Srilakshmi N

unread,
Feb 7, 2016, 11:43:48 AM2/7/16
to MIT App Inventor Forum

Taifun

unread,
Feb 7, 2016, 11:45:42 AM2/7/16
to MIT App Inventor Forum
what about providing a screenshot including Do it results of the sql statement and the result?
as a test, you also can display the result from the fusiontable in a label before splitting it into a list...
you know how to use Do it meanwhile?
see also tip 4 here 

Srilakshmi N

unread,
Feb 7, 2016, 12:01:51 PM2/7/16
to MIT App Inventor Forum
shows an erroe fr do it
ss.png

Taifun

unread,
Feb 7, 2016, 12:32:47 PM2/7/16
to MIT App Inventor Forum
this is no Do it result
you might want to learn first how to use Do it and then provide the requested screenshots
what about providing a screenshot including Do it results of the sql statement and the result?
you also might want to disable all blocks in the fusiontable control got result event and  as test display the result in a label instead



also it might help to first learn some basics...

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/book2 ... 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.org/content/CourseInABox/Intro  and the aia files for the projects in the book are here:  http://www.appinventor.org/bookFiles  
How to do a lot of basic things with App Inventor are described here:  http://www.appinventor.org/content/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
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

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



Srilakshmi N

unread,
Feb 7, 2016, 12:44:48 PM2/7/16
to MIT App Inventor Forum
Hope I'm right this time..
ss.png
ss1.png

Taifun

unread,
Feb 7, 2016, 1:33:39 PM2/7/16
to MIT App Inventor Forum
the sql statement looks reasonable... assuming, there are the columns Password and Mobile in your table... column names are case sensitive...
btw. you also can make your comment box larger like this



now: how does the result from the table look like?
you also might want to disable all blocks in the fusiontable control got result event and  as test display the result in a label instead
Taifun

Srilakshmi N

unread,
Feb 8, 2016, 8:12:48 AM2/8/16
to MIT App Inventor Forum
ss2.png
ss3.png

Taifun

unread,
Feb 8, 2016, 9:37:42 AM2/8/16
to MIT App Inventor Forum
as you can see yourself, your screenshot of the fusiontables control got result event does not help very much
you can't use Do it together with local variables, you have to assign the value of a local variable to a global variable or a label instead
this is why I recommended the following

Srilakshmi N

unread,
Feb 8, 2016, 10:15:55 AM2/8/16
to MIT App Inventor Forum
I hope this is what u meant.. Test button has the code which was in fusion table got result and result is the label which is displaying d result of test.. so maybe no value is retrieved and that's why its showing empty braces.. What do u think??
ss3.png
Screenshot_2016-02-08-20-40-48.png
Screenshot_2016-02-08-20-40-40.png

Abraham Getzler

unread,
Feb 8, 2016, 2:09:39 PM2/8/16
to MIT App Inventor Forum
Shame you threw away the first element of lsresult before we got to
see its contents.  It would have been helpful to see what's going wrong.

ABG

Taifun

unread,
Feb 8, 2016, 2:18:11 PM2/8/16
to MIT App Inventor Forum
What do u think??
well, I think, you probably start from the beginning to learn the basics...

it seems to be, it is very hard to understand for you, what I was recommending...
disable all blocks in the fusiontable control got result event and  as test display the result in a label instead
Taifun



Message has been deleted

Srilakshmi N

unread,
Feb 9, 2016, 5:40:40 AM2/9/16
to MIT App Inventor Forum
ss4.png

XXX

unread,
Feb 9, 2016, 6:43:00 AM2/9/16
to MIT App Inventor Forum
The data from the table is shown in the screenshot.
ss4.png
ss5.png

Taifun

unread,
Feb 9, 2016, 9:36:14 AM2/9/16
to MIT App Inventor Forum
following your latest screenshot we can see, that both column names Password and Mobile are correct
you also used a Mobile number in the sql statement, which is available in the table (12345)
which means, you should have received the message "Login successful"
unfortunately you did not tell us, if you got it working now

concerning your Do it results:
you already learned meanwhile (?), that you can'T use Do it together with local variables, therefore you get package result, which does not help...
also I have to assume, you first used Do it on the label before sending the query to the fusiontable, which means, it displays the text "Result", which I guess was added from you as default label text...

so the correct sequence to get a reasonable result from the fusiontable obviously is
1. send the query to the fusiontable and wait, until a result has been provided (you will now also see the result in your label)
2. then use "Do it" to display the result in the comment box

Taifun

XXX

unread,
Feb 9, 2016, 10:06:25 AM2/9/16
to MIT App Inventor Forum
No unfortunately even now it says user not signed up . don't understand a for what reason

Taifun

unread,
Feb 9, 2016, 10:18:18 AM2/9/16
to MIT App Inventor Forum
step 1: do the Pizza Party tutorial to learn how to work with fusiontables and how to set up everything correctly

you also can try your connection using my test project, which you can find here

step 2: if you got step 1 running successfully, then continue with your project

Taifun
PS:next time please provide a complete error message or a screenshot of the error message...

XXX

unread,
Feb 9, 2016, 12:50:20 PM2/9/16
to mitappinv...@googlegroups.com
It is retrieving the correct password value, but its still showing user not registered error msg..I've completed the pizza party tutorial and I've set up service account authorization for this particular app.
Screenshot_2016-02-09-23-13-10.png
ss6.png

Taifun

unread,
Feb 9, 2016, 1:30:33 PM2/9/16
to MIT App Inventor Forum
after looking again at your screenshot, my guess is, there is a leading space before the \n, which results in an empty list in the end
therefore: remove that space and it should work...



Taifun

XXX

unread,
Feb 10, 2016, 6:42:37 AM2/10/16
to MIT App Inventor Forum
The space behind the \n was the culprit. Removed it and now working perfectly. Just needed one more clarification, I also wanted to set up a forgot password button which when clicked on would ask for ur mob number and click on submit.. So is there a way that I could extract the password for the corresponding mobile number  and  send a mail from within MIT ai2, is it possible??

Taifun

unread,
Feb 10, 2016, 10:15:20 AM2/10/16
to MIT App Inventor Forum

Different eMail solutions for App Inventor

Taifun
PS: this thread is about fusiontables. For other questions, please start a new thread next time. Thank you.
Reply all
Reply to author
Forward
0 new messages