Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Wed May 24, 2017 6:26 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Generically populating database fields to window controls
PostPosted: Wed Apr 17, 2013 3:22 am 
Offline
User avatar

Joined: Sat Oct 01, 2005 4:47 am
Posts: 130
Location: Melbourne, Australia
I'm seeking some insight into a project in which I'm attempting to re-write Microsoft Access code.

The project involves database activity and will be retaining connection to MS Access mdb's. There are numerous base tables for traditional stuff such as, names, addresses, phones, log entries (these are all tables in their own right) plus a heap of other base tables. Heaps of secondary linking tables (ie. contacts - link - phones etc.) I mention this as there will be lots and lots of separate windows.

I'm attempting to be as generic as possible with the process of populating window controls (textfields, checkboxes etc.) with data from the associated SQL statements (recordsets). I've already developed classes to handle the SQL side of things.

Here's what I've come up with to date: I'm thinking to sub-class all relevant window controls (textfield, textarea, checkbox etc.), at a minimum add string properties, named, TableName & FieldName. The purpose being that these controls will contain the name of the field from the table. At the class level, cycle through the sub-classed controls, retrieve the value of the field from the table and populate the window control.

I'd like to know if I'm on the right track. What other methods or process could be employed to be as generic as possible?

_________________
Steve
rs2012 r2.1 Windows 7.


Top
 Profile  
 
 Post subject: Re: Generically populating database fields to window control
PostPosted: Wed Apr 17, 2013 9:46 am 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:48 am
Posts: 3554
Location: Lenexa, KS
You can do it that way. I've worked on a few projects that have done that.

I found them to be a serious pain. Don't get me wrong, creating generic subclasses that handled the data in and out of the controls was no big deal, it was all the edge cases that caused no end of grief. Text fields and the like are no big deal but it was the Listboxes that were almost impossible to code properly.

Real Studio database classes are pretty generic - almost too generic. Data binding at the control level doesn't really help you much, IMO, because the data conversion still has to be done to get it into and out of the database. We created ActiveRecord to make that a bit easier and to let the IDE help us (auto complete and datatype checking). More on ActiveRecord at http://www.bkeeney.com. Using AR we usually do generic Load, Save, Validate functions on our window/pages and that's worked well for us.

_________________
Bob K.

A blog about being a Real Studio/Xojo developer at http://www.bkeeneybriefs.com


Top
 Profile  
 
 Post subject: Re: Generically populating database fields to window control
PostPosted: Thu Apr 18, 2013 11:32 pm 
Offline
User avatar

Joined: Sat Oct 01, 2005 4:47 am
Posts: 130
Location: Melbourne, Australia
Thanks Bob.

Yes, the Listbox is a pain.

I checked out your ActiveRecord page which has given me some clues. Always nice to have another perspective.

_________________
Steve
rs2012 r2.1 Windows 7.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: Bing [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group