2014년 12월 11일 목요일

Getting a value from TinyDB

I am having trouble just to get a number returned from TinyDB. I have tried everything.....
Above is the simple entry in tinyDB
Below is just a trial to get see what is in the DB. In stead of a number it returns a "true".
Why does it not return a number??? I cannot see why it shouldn't.
PLEASE help :)



It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.



Ohh, I am sorry, but I did actually. they must have dissapered during uploading

Screen1
Screen2

screenshot.docx



the value to store is Textbox1.Text and not Textbox1.NumbersOnly



Thanks for your help, but it still returns a "true" only. If I write 5 in textbox 1, it still writes true in the label!
I would like to use textbox1 for any number between 1 and 10. If the user writes 5, then 5 textfields will apear on the next screen. For that I need the DB to return me the number that is written in textfield 1 on screen1. I have put the label1 on screen 2 just to see if the DB returns the correct number -but it does not! Only true...
I hope you can help - thanks again



as already said, the value to store is Textbox1.Text and not Textbox1.NumbersOnly
see also the documentation

NumbersOnly
If true, then this text box accepts only numbers as keyboard input. Numbers can include a decimal point and an optional leading minus sign. This applies to keyboard input only. Even if NumbersOnly is true, you can use [set Text to] to enter any text at all.
Text
The text in the input box, which can be set by the programmer in the Designer or Blocks Editor, or it can be entered by the user (unless the Enabled property is false). 


It would really help if you provided a new screenshot of your relevantblocks, so we can see what you are trying to do, and where the problem may be.

PS: please provide the screenshot in png or jpg format.



Yes I did try to change what you suggested, but it still returns the value true. On the emulator it returns another error. See picture.





lear your TinyDB using the TInyDB.ClearAll block, then try again
probably the Textbox.LostFocus event is not the correct event to store something in TinyDB, let me recommend to use a button click event instead

also use "Do it" to find out, what's going on
in case you do not know what "Do it" means, see tip 4 here

Top 5 Tips: How to learn  App Inventor




This is what I am trying to do. If the user enters 2 personer in screen one I want tablearrangement 2 to appear. If the user writes 3 it should not show..
I cannot see where I go wrong.




as already said, use Do it to debug your blocksTaifun




Finally! :) Thanks.
I used the TinyDB.Clearall That solved the problem. The block when textbox1.lostfocus can be used to enter data into TinyDB.


댓글 없음:

댓글 쓰기