I have an app I'm coding that will read a csv file and do some magic
on it and populate an Accounting_Temp table for moving to the main
table. It works until I get into commas in a field
(UnqualifiedReason). Any ideas on what could be happening or where I
can look?

===================================================
* Up to this point in the code, the data is correct and stored on
Accounting_Temp correctly. *

<cfquery datasource="#Datasource#" name="Check">
        Select *
        from Accounting_Temp
</cfquery>
<cfset updated=0>
<cfset Added=0>

* Still looking good.. *

<cfloop query="Check">
        <cfquery datasource="#Datasource#" name="RecordExists">
                Select *
                from Accounting
                Where EnrollmentNumber = #Check.EnrollmentNumber#
        </cfquery>

* Kablam! At this point, the Check dump shows that "test1, test2,
test3" is now "test1" in the database on Account_Temp. I also confirm
that the DB got rewritten with just Test1 *

        <cfif RecordExists.Recordcount EQ 0>
                <cfquery datasource="#Datasource#">
                        Insert into Accounting
                        
(Id,EnrollmentNumber,EnrollmentChannel,StatusName,PromoCode,QualificationType,CreationDate,State,ZipCode,UnqualifiedReason,
EnteredDate)
                        Values
                        
('#Check.Id#',#Check.EnrollmentNumber#,'#Check.EnrollmentChannel#','#Check.StatusName#','#Check.PromoCode#','#Check.QualificationType#',#Check.CreationDate#,'#Check.State#','#Check.ZipCode#','#Check.UnqualifiedReason#',
Now())
                </cfquery>
                #Check.EnrollmentNumber# Added<BR>
                <cfset Added=added+1>
        <cfelse>
                <cfquery datasource="#Datasource#">
                        Update Accounting
                        Set Id='#Check.Id#'
                        ,EnrollmentChannel='#Check.EnrollmentChannel#'
                        ,StatusName='#Check.StatusName#'
                        ,PromoCode='#Check.PromoCode#'
                        ,QualificationType='#Check.QualificationType#'
                        ,CreationDate=#Check.CreationDate#
                        ,State='#Check.State#'
                        ,ZipCode='#Check.ZipCode#'
                        ,UnqualifiedReason='#Check.UnqualifiedReason#'
                        Where EnrollmentNumber=#Check.EnrollmentNumber#
                </cfquery>
                #Check.EnrollmentNumber# Updated<BR>
                <cfset updated=Updated+1>
        </cfif>
</cfloop>
#Added# added and #Updated# updated (out of #check.Recordcount# records)
</cfoutput>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:332707
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to