actually Stephen he doesnt have this in a db yet, hes getting it from a csv file then trying to do all that.

personally, i think he should break it down, put it in the db then do just like u showed.

but his problem is that this csv file is a friggin mess (i think) and hes trying to get to clever with the code. But the csv file is generated by a pharmacys software program which means he probably has no control over how its made.

i'd say get the csv & rip it out 1 line at a time, get the info for 1 line (1 record), break the line down & insert it to the db then delete the line and loop it.
the one i am doing actually only needs the last line of code which makes it fairly easy to get at but he could do the same. Will take a few minutes to do but would be easier.

once its in the db its a piece of cake, not to mention having to worry about corrupt data doing all that other stuff & in this case is a very big deal. although, the laws maybe different in australia then here but i would assume.....

---------- Original Message ----------------------------------
From: "Stephen Moretti (cfmaster)" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Date:  Tue, 21 Sep 2004 08:36:38 +0100

>Brant Winter wrote:
>
>> Dave - I assumed it would involve some complex looping to work out which
>> drugs below to the same patient on the same day etc etc.
>>
>> I am using the following code to generate a query object from the CSV
>> file:
>>
>> <cfhttp url="" name="qGetData" method="GET"
>> timeout="20" delimiter="," textqualifier=""""></cfhttp>
>
>
>Brant,
>
>I think like Dave says - you're going at this BAB...  Don't try and
>create seperate structs and arrays for all this data, just leave it in
>your query, but reorder the data using QofQ into something that helps
>with the output.
>
><cfquery name="sortedPatients" dbtype="query">
>SELECT * FROM qGetData
>ORDER BY Medicare, LastName, FirstName
></cfquery>
>
>Then you have a straight loop of medication by patient and all you have
>to do is split them into scripts.
>
><cfset prevmedicare = 0>
><cfset medcount = 0>
>
><CFLOOP QUERY="sortedPatients">
>    <cfif prevmedicare neq sortedPatients.medicare>
>       <cfif sortedPatients.currentrow NEQ 1>
>             <!--- Output script Footer, if I'm not on the first record --->
>       </cfif>
>    <!--- new patient --->
>        <cfset medcount = 0>
>        <cfset prevMedicare = sortedPatients.medicare>
>      <!--- Output scriptheader --->
>    </cfif>
>    <cfif variables.medcount eq 3>
>        <cfset medcount = 0>
>       <!--- Output the footer of script --->
>       <!--- Output the header of next script for this patient --->
>    </cfif>
>    <!--- Output single row of the script --->
>
>    <cfset medcount = IncrementValue(medcount)>
>   
>    <cfif sortedPatient.recordcount eq sortedPatient.currentrow>
>    <!--- See if this is the last record and output a script footer if
>it is --->
>    </cfif>
></CFLOOP>
>
>Clear as mud??
>
>Stephen
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to