2017년 1월 5일 목요일

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


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.



--
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
-- 
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.

--
Here's the latest verison of the blocks and error, do hv a look at it


--
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
Frequently Made Errors with Fusiontables and how to fix them


Edit: 2 screenshots added for recommended solution 

--
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.

--
here is your fish
a complete login example using a fusiontable as simple as possible
--
Thank you, I'll check it and get back to u in 10mins :)

--
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!!


--
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??

--
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?
--
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?
--
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. 

--  
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 
shows an erro fr do it

--
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.

--
Hope I'm right this time..



--
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

-- 


--
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
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

--  
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??



--
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.

--
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
--

--
The data from the table is shown in the screenshot.



--
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


--
No unfortunately even now it says user not signed up . don't understand a for what reason

--
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
How to use the Service account option to connect to a Fusiontable


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


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

--
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.



--
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...
--
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??

--

PS: this thread is about fusiontables. For other questions, please start a new thread next time. Thank you.

--

댓글 없음:

댓글 쓰기