SQLite database manager app using B4XPages, B4XDrawer, B4XComboBox, B4XTables, B4XDialogs and CustomListViews.

PaulMeuris

Active Member
Licensed User
Working with SQLite databases doesn't have to be difficult.
In this tutorial you can learn how to use SQLite databases in a Database Manager app.
The app uses B4XPages, B4XDrawer, B4XComboBox, B4XTable, B4XDialog and CustomListView components.
A SQLite database class module is also included.
Instructions on how to export and import database files are provided in the first chapter.
Where do you find the goodies? Here: B4A-database tutorial.
Happy coding!
Paul
tut5_002_01.png
tut5_002_04.png
 

PaulMeuris

Active Member
Licensed User
EDIT: you can solve the error that was mentioned in the remarks section about the search field in the B4XTable by changing some lines of code.
It turns out that in the tables some fields were set to NULL. The search field can"t handle this condition.
So by setting the content of the cell to the text "NULL" there is no more problem.
 

PaulMeuris

Active Member
Licensed User
This tutorial uses a lot of B4X components.
Although it's a tutorial for B4A it's also an opportunity to learn more about using the B4X code in a B4J project.
The assignment therefore (should you accept it) is to make a B4J application that has the same functionalities as the B4A app.
This is still the link: B4A-database and the assignment is the last chapter.
Happy coding!
Paul
P.S. the edit from the previous message can be found in the Remarks chapter.
 

PaulMeuris

Active Member
Licensed User
In the B4J project you have to change the color of the B4XComboBox with a piece of code even though the designer shows the color.
This is the designer image:
tut5_002_30.png

This is how it looks like without the change:
tut5_002_31.png

And this is how it looks like with the code change:
tut5_002_29.png

In the B4XPage_Created subroutine you have to add the following line:
color yellow of the B4XComboBox:
    CSSUtils.SetBackgroundColor(cbxtables.cmbBox, fx.Colors.From32Bit(0xFFFFE884))
The libraries jFX and CSSUtils are used for this to work. Declare the variable fx as JFX.
Note: the xui.Color_ARGB(100,255,255,255) method evaluates as an Int whereas the fx.Colors.From32Bit evaluates as a Paint type.
Happy coding!
 

PaulMeuris

Active Member
Licensed User
Check out the updates section of this tutorial.
You can add a webview to the MainPage layout to show the visible data of the table.
The subroutine ExportToHtml ( thank you @Erel ) collects the data from the table.
By expanding the query with the LIMIT keyword the resultset will only contain the records that are visible in the B4XTable.
You can apply this update in the B4A and B4J version of this app/application.
Happy coding!
 

Xfood

Expert
Licensed User
in fact it would be very convenient that in addition to the excellent tutorial, at the end there was the link of the project to download, to try the complete project, and study it better, instead of copying and pasting all the parts to recreate the project
 

PaulMeuris

Active Member
Licensed User
It took me some time to write the tutorial. In this tutorial you might learn new concepts, ways of doing things and so on.
So the least you could do is read the tutorial, follow the steps to assemble the code in a project and then test it.
The reward at the end is a fully functional FREE app and in this case you can also build a B4J application with the same functionalities!
 

PaulMeuris

Active Member
Licensed User
I have applied another update in the ExportToHtml subroutine.
When the search field is used then you can use the BuildQuery method from the table.
Setting the argument from this method to True also takes care of the limits.
You can find the modified code in the tutorial. See message #1 for the link.
Happy coding!
 

AnandGupta

Expert
Licensed User
Longtime User
It took me some time to write the tutorial. In this tutorial you might learn new concepts, ways of doing things and so on.
So the least you could do is read the tutorial, follow the steps to assemble the code in a project and then test it.
The reward at the end is a fully functional FREE app and in this case you can also build a B4J application with the same functionalities!
Understood.
But being a programmer and that too a lazy one I wanted to get the full basket in one go.
Will follow your advise. 👍
 
Top