Select one line in a SQLite query

Hi everybody!!

Im working with Data Bases (SQLite) in Corona SDK and I have a question.

I know how to show one query (local sql = “SELECT * FROM zipcode”, for example)

My problem is, I would like that the user can select one zipcode from the table for use in other storyboard and save this line in other Data Base.

How can I show a “better” view of the data? (TableView?)

How can I implement a “Radio Button” inside storyboard? (I think that Corona SDK haven’t support to create widget inside storyboard )

Is possible create a widget inside the Storyboard? (If this option is possible I know how to send to other storyboard)

I couldn’t find examples/code about it

Thanks in advance

Regards!

You can absolutely use widgets in Storyboard.  Try putting them in the enterScene event, just make sure you require the “widget” library at the top:

[lua]

local widget = require( “widget” )

function scene:enterScene( event )

 local tableView = widget.newTableView{

  – table view options

 }

 self.view:insert( tableView )

end

[/lua]

http://docs.coronalabs.com/daily/api/library/widget/newTableView.html

Take a look at parameters in storyboard documentation. You can pass a parameter from one storyboard scene to another. You would typically present all data on scene 1, when user taps on a record you would then pass the criteria (ie zip code) to the second scene. The second scene then would execute a select * from xyz_table where zipcode_field = parameter_passed_from_scene1 kind of sql and build your scene 2 tableview based on the results. Good luck.

You can absolutely use widgets in Storyboard.  Try putting them in the enterScene event, just make sure you require the “widget” library at the top:

[lua]

local widget = require( “widget” )

function scene:enterScene( event )

 local tableView = widget.newTableView{

  – table view options

 }

 self.view:insert( tableView )

end

[/lua]

http://docs.coronalabs.com/daily/api/library/widget/newTableView.html

Take a look at parameters in storyboard documentation. You can pass a parameter from one storyboard scene to another. You would typically present all data on scene 1, when user taps on a record you would then pass the criteria (ie zip code) to the second scene. The second scene then would execute a select * from xyz_table where zipcode_field = parameter_passed_from_scene1 kind of sql and build your scene 2 tableview based on the results. Good luck.