Well, I would make a database file so you can do simple atomic updates
too the column names, so make columns:

Filename, fieldname, label, datatype

Write a simple CFC that takes a filename and a fieldname as arguments
and spits out the proper column label

Then where you would normally do column heading output, replace with a
cfc, something like: #cfc.getHeading(myFileName,myFieldName)#

Build a simple front end for your stored labels (cuz you know they are
going to change em, no sense hard coding em) and life should be good =)


As an alternative, I know SQL 2005 has a description attribute on each
field, maybe there is some way to programmatically get that?

Chris Peterson

-----Original Message-----
From: Les Mizzell [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 07, 2007 3:19 PM
To: CF-Talk
Subject: Matching database field names with label names

I've had a request for an "audit trail" for a SQL Server based 
application. I've gotten triggers set up in the database that logs all 
changes, and records the field name, plus old/new values for 
comparision. This is, as usual, an "add on" request after all other work

was finished and never in the original spec. Oh, they'll pay, but that's

not the problem...

The client wishes to be able to view the audit trail for any specific 
record between various dates and various other blah, blah, search
criteria.

No problem here.

OK, what's now giving me a fit is that they don't want to see the 
database field name, but the label that's on the original form. So, in 
my "audit table", I've got stuff like:

field_name      action          old_value       new_value
IV_1_predef     Update          whatever        new whatever
VIA1_PPA        Update          whatever        new whatever
II_B_dtON_d     UPdate          whatever        new whatever

This stuff span eight tables and several hundred fields

OK, in code, what would you think the most compact/fastest way to match 
up the "field_name" and the label name for display purposes?

All I can think of is to set up a huge array:

<cfset fldlst[1][1]="IV_1_predef"> (field name)
<cfset fldlst[1][2]="Predefined System...blah"> (label name)

..... and then loop through it looking through matches in 
audit_table.field_name.

Seeing that you could end up looping through the entire array dozens of 
times just to display one set of results - don't seem too good.

Anybody got any other ideas?









~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
The most significant release in over 10 years. Upgrade & see new features.
http://www.adobe.com/products/coldfusion?sdid=RVJR

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280419
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to