Home » Archives » February 2004 » Displaying database index tag names in combo boxes

[ Previous entry: Peculiar... ]
[ Next entry: Chess and software development ]

Displaying database index tag names in combo boxes

Here's a simple 2:00AM code I made. Its objective is to make a certain combo box automatically reflect the tag names for the databases you are currently using.

with thisform
nTagCount = tagcount()
dimension aIndex(nTagCount)
for nCount = 1 to tagcount()
if !empty(tag(nCount))
store tag(nCount) to aIndex(nCount)

.cmbIndex.rowsourcetype = 5
.cmbIndex.rowsource = 'aIndex'
.cmbIndex.value = aIndex(1)

It's too simple really but this was the first time I used this. I even had to refer to Foxpro's help file in the formulation process.

The main purpose is to create a template form for the 'File Utility' type of modules. The term 'File Utility' was something I have acquired from College MacPros (Machine Problems). This is a part of those old DOS based Programs we had back then (created in either Pascal, C/C++, Clipper 5.2) which hold the records for your database-based values, or as one of my clients call it... directories.

This has been a practice which I find useful especially when you're already in the maintenance mode of your program. Directories like this, however, should be planned in advance. The 'Design phase' of your project is a good place to start.

These directories can also be used inside combo boxes, and if in the future you would like to add values that those combo boxes display, you don't need to touch the hard code. You just either edit the database or use your File Utility module.

Very handy too when your database application is being used by more than one client.

Let's give an example.

Suppose you have a combo box for Profession. Of course you can choose the combo box builder wizard and enter the data by hand but that would be lame.

Totally lame that only castrated over-boozed programmers of the 60s do that.

You use a database approach and set the combo box to grab the values of that database.

     .cmbProf.rowsource = 'DATABASENAME.FIELDNAME'
.cmbProf.rowsourcetype = 6

... where cmbProf is your Profession combo box and 6 stands for (database) fields, the source of the values the combo box will display.

You can also use the Property box to set things. Other sources include value, alias, sql statement, query (.qpr), array, files, structure, popup, DoomPortal, BermudaTriangle, RiverofLesRough and so on.

Now back to the code above (Darn I'm wandering off once again), the algorithm gets the number of tags the compound index file has, gets the tag names and stores them in an array.

Now using the values in that array, you can place the code below in an object (a 'Browse' command button perhaps).

     select FILEAREA
set order to alltrim(.cmbIndex.value)

This will reflect the changes you want to view, which in my case is found in a grid that displays the sorted records.

Figure 292.1 Image too shy to enlarge itself since its design and alignment was not optimized yet. Check back later when Image.nConfidenceLevel++.

Disclaimers are for castrated EARTHLINGS.
Powered: GREYMatter | GM-RSS








February 2004
February 2006
January 2006
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004

GEEK count:
visitors since the aliens rebooted the counter last 02.23.2006 (was around 33,000++ before the alien intrusion | SINCE: 02.26.2004)