don't forget that valid sql names are likely to be valid cf variable names, so 
a structure with labels[table_name][field_name] is likely to work well.

----- Original Message ----
From: Les Mizzell <[EMAIL PROTECTED]>
To: CF-Talk <[email protected]>
Sent: Thursday, June 7, 2007 12:18:43 PM
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?









~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280421
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