I have a project that requires a fair amount of validation. I will be
process several dozen text files each night. Each text file contains
8500 records. Each record contains 35 fields. Each field requires at
least some basic validation, other fields the validation gets more
involved. A little math, 8500 records times 35 fields, at a bare
minimum that's nearly 300,000 validation processes per file. The reality
is probably 3- 4 times that number.
I have a couple of questions. Some of the required validation can be
re-used within the project so I am considering writing a cfc for each
field. That would be 35 cfcs with two to several validations per cfc
based on the requirements for the field in question. If I have a master
validation cfc that calls the other 35 cfcs and stores them in memory
will that reduce the overhead of calling each one 8500 times per file?
Is there a better way to handle this?
When validating data are there best practices, or preferred methods?
For instance.
I have to validate that a variable (record_id) is one of these (1,2,4,
A, B,C) six value. This appears to be rather basic and I've written the
validation two ways. Is one better than the other? Or is there a better
method for handling a validation like this?
<cfset record_id = 2>
<cfset record_id_values = "1,2,4,A,B,C">
<cfif record_id is '1' or
record_id is '2' or
record_id is '4' or
record_id is 'A' or
record_id is 'B' or
record_id is 'C'>
record_id is an accepted value
<cfelse>
record_id is not an accepted value
</cfif>
***************
<cfif listContains(record_id_values, record_id)>
record_id is an accepted value
<cfelse>
record_id is not an accepted value
</cfif>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:273846
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4