Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Highlighted
New Developer
Posts: 8
Registered: ‎12-06-2012
My Device: Bold 9930, BlackBerry Playbook and Dev Alpha A
My Carrier: Verizon

database help

I am working on an app that needs a user to enter their name in a text field and then have four different textFields that need to be able to repopulate and then when saved be sent to the database. How can I set the database up to do this instead of having info1, info2, info3, info4....etc. I want to be able to have this as a potentially unlimited entry and then pull to a page displaying the user names, and on clicked will pull the info for just that user.
Webworks and Cascades developer. My son has Cystic Fibrosis, learn all you can about this genetic ilness.
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: database help

What do you mean by repopulate? Do you mean reload a previously saved set of fields from the database when coming back to that page?

 

How far have you got so far with setting up the database? reading from it, writing back to it, etc.?

 

Why don't you take a look at some of the samples that do exactly that, such as the Quotes or Stamp Collector samples...

http://developer.blackberry.com/native/sampleapps/


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
New Developer
Posts: 8
Registered: ‎12-06-2012
My Device: Bold 9930, BlackBerry Playbook and Dev Alpha A
My Carrier: Verizon

Re: database help

I have four main text fields in my QML that hide and show as the user enters data. So four text boxes show, user enter info hits add more and those get hidden and the next four show. This is fine.

Yes I have a working database, with add, delete update working. This is a test database while I work on the final one. I know enough to do the basic database. However, what I'm looking to do, is setting this up into accepting the day at that the user inputs into groups. This way I do not have to write in the data base 40 different 'color' 40 different 'cars' basically write it to accept all the user input from cars at one time as an array instead of individually.

So user inputs text field 'cars1', 'cars2', 'cars3', etc...hits input and it inserts all 'cars' data into the cars category column on the database.

Hope this clarifies a bit.

Webworks and Cascades developer. My son has Cystic Fibrosis, learn all you can about this genetic ilness.
Developer
Posts: 16,997
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: database help

could you elaborate a bit about the data you want to store?

is it ordered in any way or is it all dynamically built?

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Developer
Posts: 8
Registered: ‎12-06-2012
My Device: Bold 9930, BlackBerry Playbook and Dev Alpha A
My Carrier: Verizon

Re: database help

It's all dynamically built as user enters info into text fields on the main QML page. So user enters data in text field for cars1, cars2, cars3, etc...hits submit and the data is transfered from all textFields into the cars group column in the database.
Webworks and Cascades developer. My son has Cystic Fibrosis, learn all you can about this genetic ilness.
New Developer
Posts: 8
Registered: ‎12-06-2012
My Device: Bold 9930, BlackBerry Playbook and Dev Alpha A
My Carrier: Verizon

Re: database help

Right now my test database is set up with one column for each text field entry, and this can make for a lot of extra coding in the database. So 'cars1' textfield goes to cars1 column, 'cars2' textfield goes to cars2 column, etc....if I can simplify the database to accept the dynamic input from the QML as an array for a group that would be ideal.
Webworks and Cascades developer. My son has Cystic Fibrosis, learn all you can about this genetic ilness.
Developer
Posts: 16,997
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: database help

and is "cars" also something the user entered before?

i think i would use a single table for all thematically grouped entries a user does.

for example:
table titles, id + title
table cars: id, titleId, car (single text entry)
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Developer
Posts: 8
Registered: ‎12-06-2012
My Device: Bold 9930, BlackBerry Playbook and Dev Alpha A
My Carrier: Verizon

Re: database help

I'll post a sample of what I have later. As I'm not near my computer.
I have a single table now with table users: I'd, user, car1, car2, car3, car4, etc...as you can see this creates a mess.
I get what you mean with your table, but how do I do the add statement to get cars1, cars2 cars3 to all go to cars column at same time when user hits submit?
Webworks and Cascades developer. My son has Cystic Fibrosis, learn all you can about this genetic ilness.
New Developer
Posts: 8
Registered: ‎12-06-2012
My Device: Bold 9930, BlackBerry Playbook and Dev Alpha A
My Carrier: Verizon

Re: database help

currently I have insert into users cars1, cars2, cars3, cars4 etc... as I'm new to sqlite and databases in general I am lost on some of this.
Webworks and Cascades developer. My son has Cystic Fibrosis, learn all you can about this genetic ilness.
Developer
Posts: 16,997
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: database help

i think you should read a bit about basic database design, it will make things a lot easier for you.
these concepts are not really on topic in native development and also difficult to explain without some samples and graphics, so i think you'll find more helpful resources, now that you know what you have to look for.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter