I think you have a good plan here, for the most part, but you are
going to run into performance issues.  I have used ColdFusion to do
batch processing of large text files in the past, and it is NOT
efficient, in fact I would say that it is very inefficient at this
task.  I am not saying that CF is inefficient overall, just with large
text files.  I have bugged Macromedia about it before, we'll see if
Adobe addresses this issue in future releases.

That said, there are Java methods of doing this that are much quicker
than plain CF.  Do some googling for something like "java file
processing coldfusion" and you'll probably find some good articles.  I
think Ben Nadel has some good blog entries on this subject as well
(bennadel.com).

As far as validation, regular expressions are your friend.  Your
example below would work, but regular expressions will do it with less
code (except for the second method, maybe), and they are very
powerful.  If you need any help with regex, just ask here and you'll
quickly get the answers you need.  :)

On 3/27/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> 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>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW

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

Reply via email to