I'm working on creating an "audit trail" for a database (and have
discussed methods here earlier. I've had triggers set up that records
all changes, dates, the field name in question and before/after values.
I've got it working GREAT except that the client needs to see the form
label values, not the actual field name in the database:
"Date Database Taken Offline" instead of "I_M1_dtOFFLINE"
We tried doing this by accessing the "comments" field in the SQL Server
database and adding the labels there, but to no avail. All I can figure
to do it set an array for each table connecting the field names and
database table names:
<cfset array_genINFO=ArrayNew(2)>
<cfset array_genINFO[1][1]="IA_sysname">
<cfset array_genINFO[1][2]="1. Logical System Name">
<cfset array_genINFO[2][1]="IB_funct_area">
<cfset array_genINFO[2][2]="2. System Functional Area">
....... and so on
OK, so I now need to return the results from my audit table and match up
the values. - with are stored as "[fieldname]" (with the brackets stored
as part of the value - and then display the label instead of the fieldname
Something like:
<cfloop start="1" end="43" index="i">
<cfif #getAUDIT.FieldName# EQ #evaluate(array_genINFO[#i#][1])#>
Changed Field: #evaluate(array_genINFO[#i#][2])#
</cfif>
</cfloop>
The darned brackets stored in "#getAUDIT1.FieldName#" are throwing me
off though - so the above isn't quite correct. You end up with:
<cfif "[somefieldname]" eq "somefieldname">
How do I strip those brackets, keep the loop working correctly and find
the appropriate value? It's simple I'm sure, but I've been awake too
long and can't quite grasp it at this moment.
Little help please?
Thanks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:282931
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4