DBKit, making creating database front-ends easier

I’ve created a new kit to make building database front-ends for the desktop and web faster. You can get your app’s UI connected to a database with very little code. There are two example projects (one for desktop, one for web) but the DBKit module inside is designed to be copied into your own projects for use. A video walkthrough of the tutorial is available on YouTube.

DBKit requires Xojo 2023r2.

Details about DBKit can be found in the 2023r2 documentation at Topics > Databases > DBKit. There are also desktop and web tutorials in Getting Started > Tutorials. I highly recommend you do one of those two tutorials to get started. If you find any bugs in the documentation or projects or have feature requests for it, please report them with Issues , prefixing your report with “DBKit”.

The DBKit desktop and web example projects can be found in Examples > Databases.

There is code in DBKit for mobile projects but the mobile example and tutorial are not ready yet so that part of the code is entirely untested.

DBKit is still in beta but is quite functional.

If you have any questions, feel free to ask them here.

Release Notes for today’s 1.0b5 pre-release

  • When editing a row or adding a new row, the focus is now automatically set to the first TextField or TextArea in the tab order.
  • Fixed a bug that caused the Edit button to be disabled after pressing the Undo button.
  • DBKitSearchResultsListBox columns can now be bound via the Columns property in the DBKit section of the Inspector instead of having to do it in code with the BindDatabaseColumns method though that too still works.
  • It is no longer necessary to set up the connection for a DBKitConnector on a layout if one has already been established and stored in an App class (desktop) or the Session (web) classes. DBKitConnector looks for the connection in those objects and will use it if it finds it. You can still create the connection in code if needed.
17 Likes

Geoff,

I have a problem that when I change an item to e.g. DBKit.Web.DBPopupMenu the DBKit properties don’t show up in the inspector until I close/reopen the project. Makes it unusable when developing.

This is on Windows 10 Xojo 2023r2

SORTED - Noticed I have to drag the required items in from the ‘Project Controls’ section

Web Tutorial step 10 should read:

me.TargetDBImageViewer = Photo

Me should not be required since this code is in the Opening event of the class of which TargetDBImageViewer is a property.

I will take a look at this now.

OK, I can reproduce this on macOS as well. Not sure what’s going on. Almost certainly an IDE bug. I’ll have Ricardo take a look.

works with ‘me.’ doesn’t work without it - it’s in the demo version as well.

I edited original post to say all OK if I select the control from ‘Project Controls’

https://tracker.xojo.com/xojoinc/xojo/-/issues/73728

While on the same kinda topic - how about collaborating with Appeon on developing a (Powerbuilder) Datawindow control for Xojo?

Might have more potential ( mostly legacy- but often big - clients ) now that Xojo Android is out-there…

just sayin’

I just went looking for a recent video on DataWindow but can’t find one. Do you know of one? I’d like to look at it because we do have some technology in development that might be similar.

here’s an older one - while I look for recent versions.

I doubt the essentials have changed ,much. I can give a summary from when I used to use them though - Datawindows contain internally the SQL code for data queries - plus all the internal logic etc necessary to handling editing the result and updating the SQL database.

They in essence “know” everything in-depth about the client-server connection and interaction - whether ORACLE, Sybase, ODBC or something newer.

So it’s a forms engine OR reporting engine that handles everything transaction wise.
But goes so much further in that one can actually ( if willing to spent the time - and if one really needs it ) create and build data windows on-the-fly -

Nowadays I think the IP owners ( used to be Sybese, then SAP, now I believe - Appeon ) probably focus more on selling the Datawindow IP as a control inside /NET - so can be used with C#.

https://youtu.be/o82Magu_vpw?si=2zgdRlL1vA1Uj841

a more recent one from Appeon - https://youtu.be/d0Snyy4UeUk?si=xyhmDfqYhvFgp17L

https://youtu.be/o82Magu_vpw?si=2zgdRlL1vA1Uj841

feel free to email me if you have further questions - but it IS a very long time since I used them -

Might be worth contacting Appeon to see if theres a possibility fort collaboration - because far as I know - theres currently no version of PowerBuilder build target for OSX.

Just Windows and a web target for Powerbuilder apps and I believe mobile OS target versions. but no OSX target - nor linux.

Can I use multiple connectors in an application?
If so how do I indicate which database the window should use?

Yes, you can. In fact, you can use multiple connectors per layout as well. By default, DBKit assumes that all connectors will connect to the same database. However, in your situation, in the Opening event of the Connector call the Connected method and pass it the information about the database to which you want it connected. Or if you have already connected to the other database and stored that connection somewhere, you can just set the Connector’s Connection property to that new connection.

If you look at the tutorial, you can see how it connects. You can simply create another connection to another database but then set that Connectors you want connected to that other database in their opening event.

Let me know if you have any questions.

Hi @Geoff_Perlman I’m just wondering if their’s anything I can do about the speed of my database project on the web. I have a table with around 800 records that takes about 30 seconds to load and display in a weblistbox via dbkit. The issue is that search works well for a small subset of records, but when I clear the search box, it takes another 30 seconds to reset the view. Any thoughts?

Also, aside from the bug mentioned above with popup menu’s in the inspector, I’m having problems linking a table and column that isn’t my default dbkit assigned table to a popup.

In the eddies example I’d like to be able to populate the list of states in the popup without having them available in the ‘customers’ table that is the default dbkit table. Ie, I should be able to populate from the ‘States’ table if I’m reading the docs right using AutoPopulate. I get an error if I try this though as my popup control name is not a column in the dbkit default table.

And BTW, am loving the kit, it’s made my life so much easier, I’m now going through a few older projects and simplifying greatly.

Hi James. There’s clearly something wrong if it’s taking 30 seconds to display 800 rows. Can you send me the project so I can take a look?

Regarding DBKit, have you looked at the Desktop and Web example projects? They populate the States popup menu. Or is that the example you meant?

Glad to hear you are finding DBKit useful. There’s much more to be done with it. I just need to get back to it.

Hi Geoff,

Please note:

a) I am very very new to SQL programming. Previous relational database experience is with the old FileMake Pro
b) I have used Xojo since the RealBasic days, but it has been a few years.
c) Previous apps were dedicated to molecular systematics, with largely string data (ACTG, Protein codes, etc.) and lots of math.
d) I am now wanting to build a database for fly tying.

The dbKit seems great for me.

Is there a way to use dbKit with a relational database. Your examples seem to be flat file databases. For example, can I bind a table to a listbox using a key? So the fly is a Parachute Adams. In table 1, I have FlyName as key, FlyPhoto, and a listbox with materials used. I would like to take the materials from table 2 containing material type and supplier. Then I would like to have a window that shows all the flies that use a particular material.

Sorry for being long winded. If you can point me in the correct direction I would be greatly thankful.

Best to you and yours,

Tom

Hi Thomas,

Yes, you can indeed use it for a relational database. Each DBKit.Connector manages a single table. So if a layout is going to have two tables displayed (let’s say Customers and Invoices), you’d have two DBKit.Connectors on the layout: one for each table. When the user clicks on a customer in a listbox (for example), In Customer connector’s LoadingRow event you could then do a query for the related rows and have the Invoices connector add them. Eventually I will make that automatic (provide a way for you to indicate related tables) but for now, you should be able to do it as I’m describing. In the example, take a look at how rows are handled in the SearchForCustomers method. You’d do something like that but for invoices and call it from the Connector that is handling the Customers table.

Hi Geoff,

Thanks tons! That makes total sense. It seems like I could make a module with some table properties (e.g. Keys and DBKit.Connector(s)) and a few methods to handle the relationships. In other words, abstract some of DBKit to be layout independent. Or would that just get really messy. I am thinking out-loud here.

Thanks again for your help. Xojo has come along way from the RB days! Hope to see you again at a future Xojo conference or Xojo get-together.

Cheers,

Tom