6 Replies Latest reply on Jun 19, 2006 12:51 PM by BKBK

    File Rewrite

    reya276 Level 1
      I want to rewrite a list of files, but I don't know how to go about doing this, I have some code that I have implemented but this code only copies one of the files and then dies when it tries to perform the query (HTTP 500 Error). So I want to rewirte as may files there can be on the directories I specified.
        • 1. File Rewrite
          BKBK Adobe Community Professional & MVP
          > directory="#dirName#"
          directory="#variables.dirName#", to distinguish it from form.dirName

          > destination="C:\Inetpub\wwwroot\webapps\ipa_warehouse\fileformat"
          destination="C:\Inetpub\wwwroot\webapps\ipa_warehouse\fileformat\", with a backslash at the end

          > WHERE ACTIVITY_DATE > '1/1/2005'
          WHERE ACTIVITY_DATE > #createdate(2005,1,1)#, perhaps, without the single quotes

          > #dirName##dirFile#.cln
          what does it point to, given that #dirName##dirFile# points to a file?

          > <cffile action="write" file="#dirName##dirFile#.cln" output="foutput">
          <cfoutput query="foutput">
          <cffile action="append" file="#dirName##dirFile#.cln" output="#SEQ_MEMB_ID#,#ACTIVITY_DATE#,#PCP#,#Spec#,#WDW_STATE#,#WDW_FUNDING_COUNTY#,#WDW_ PRODUCT#,#PLAN_CODE#,#WDW_IPA_ID#,#WDW_PCP_ID#,#WDW_INPUT_CHANNEL#,#WDW_COHORT#,#WDW_ELIG_ CATEGORY#,#MASTER_DOB#,#MASTER_SEX#,#pop#,#doc#,#dob#,#age#,#sex#,#Year#">
          </cfoutput>


          • 2. Re: File Rewrite
            reya276 Level 1
            Thanks for replying to the thread, looking at the code you provided it does not seem that you account for the amount of files in a directory being different. These files will change at any given moment which is the reason why I was trying to do a loop and get all the files regardless of how many. This is one of my biggest issues not knowing how many. also if I remove the switch statement how would it know which directory to process.
            • 3. Re: File Rewrite
              BKBK Adobe Community Professional & MVP
              it does not seem that you account for the amount of files in a directory being different.
              I don't understand how you got to that. It is not for me to draw conclusions about amounts of files. I have only made corrections to your existing Coldfusion and SQL code.

              if I remove the switch statement how would it know which directory to process.
              No one asks you to remove the switch statement.

              • 4. Re: File Rewrite
                reya276 Level 1
                Oh I understand, did not realized you were just making corrections. I will apply this and see how it goes, Thanks!
                • 5. Re: File Rewrite
                  reya276 Level 1
                  I tried running the updated code but I got an error when it tried running query portion of the code it says this:
                  Error Executing Database Query.

                  Query Of Queries syntax error.
                  Encountered "2005.

                  38 : WHERE ACTIVITY_DATE > '#CreateDate(2005,1,1)#'

                  I also tried running it without the quoates and instead it gives me an error:
                  Error casting an object of type to an incompatible type.

                  any ideas?
                  • 6. File Rewrite
                    BKBK Adobe Community Professional & MVP
                    it says this:
                    Error Executing Database Query.


                    Did you do it without the quotes? That is,

                    WHERE ACTIVITY_DATE > #CreateDate(2005,1,1)#

                    If that also fails, then we should probably do

                    WHERE ACTIVITY_DATE > #CreateODBCDate(CreateDate(2005,1,1))#