如何防止CF电子表格群体挂起?

时间:2016-09-20 19:02:26

标签: coldfusion coldfusion-10 cfspreadsheet

当我填充cf电子表格对象的行并创建一个xls文件时,我遇到了麻烦。在我的开发服务器上,整个过程只需要大约一分钟,但在我的prod服务器上,页面在我的查询循环的第一次迭代中无限期地开始挂起。我已经评论了下面的代码中的内容。

对于qReconciled中的每一行,循环查询(这是连接的结果),我在电子表格中创建3行 - 第一行从连接的一侧保存数据,第二行保存来自连接另一侧的数据,第三个是空白行。

查询qReconciled(有大约2,200行)没有问题;我在dev和prod的SQL Server studio中运行了查询,在这两种情况下,它只用了大约一分钟就可以运行。

请注意,对于dev和prod服务器,CPU在进程运行时固定为100%或接近100%。但是当开发服务器是一个专用的盒子时,prod服务器是一个虚拟机,其他3个虚拟机共享同一个盒子,所以我想知道它是否只是一个VM内存分配问题。

<cfparam name="url.from" default="" />
<cfparam name="url.to" default="" >

<!---dates for from and to come in the format "yyyy-mm-dd"--->

    <cfset vImportName = "" />
    <cfset vDateTitle = "" />
    <cfset oStarsImporter = CreateObject("component", "#application.cfcpath#.starsImporter") />
    <cfset qReconciled = oStarsImporter.getReconciled(url.importId, url.from, url.to) />

    <cfif isDate(url.from) AND isDate(url.to)>
        <cfif len(trim(vImportName))>
            <cfset vImportName = vImportname & "-" />
        </cfif>
        <cfset vDateTitle = "From_" & dateFormat(url.from, "mm-dd-yyyy") & "_to_" & dateFormat(url.to, "mm-dd-yyyy") />
    </cfif>

    <cfset vFileName = vImportName & vDateTitle />

    <cfif NOT len(trim(vFileName))>
        <cfset vFileName = "All_reconciled_" & dateFormat(now(), "mm-dd-yyyy") />
    </cfif>

    <cfset currentSpreadSheetRow = 1> <!---start at 1, to ignore spreadsheet header row--->

<!---Below is handy a way to generate an Excel sheet without having to save any file to the server...--->

    <cfset s = spreadsheetNew()>

    <!--- Add header row --->
    <cfset spreadsheetAddRow(s, "Assessment Source,Client Last,Client First,SSN,Gender,Client Case Number,DoB,Zip Code,Assessment Type,Assessment Status,NYCWAY Appt Code,Appt Date,Appt Time,CASAC Worker,Approving Supervisor,Benefit Status (Case Type),Final Recommendation,Site Code,Re-Assessment,Current Living Situation,Mental Conditions,Candidate for WeCARE,Attend Substance Use,Agency Name,Currently Attending Treatment Program Name,Type of Treatment,Opioid Taken,Housing Outcome,Return to Treatment Provider,Non HRA-Approved,Name non-HRA Site,New Mandate,Transfer to New Treatment Provider,Check-in,Assessment Start,Checked Out Time,Checked-in Site,Addendum,Consent B signed")>

    <!---For each row in the query, create *3* rows in the spreadsheet. One for STARS, one for SACAP, and a blank row--->
    <cfloop query="qReconciled">

        <!---Need to do this, else spreadsheet won't recognize as string--->
        <cfset tCheckin = " #timeformat(dcheckin,'short')#" />
        <cfset tAssessmentStart = " #timeformat(dAssessmentStart,'short')#" />
        <cfset tCheckouttime = " #timeformat(dCheckouttime,'short')#" />
        <cfset tTimeInBin = " #timeformat(timeInBin,'short')#" />
        <cfset tApptBeginTime = " #timeformat(dApptBeginTime,'short')#" />
        <cfset tApptEndTime = " #timeformat(dApptEndTime,'short')#" />
        <cfset tAppointmentTime = " #timeformat(dAppointmentdate,'short')#" />
        <cfset tScheduledTime = " #timeformat(scheduledTime, 'short')#" />

        <cfset arrThisRowSTARSValues = ['STARS','#vClientlname#','#vClientfname#','#vSSN#','#vGender#',#listFirst(vClientcasenumber, '-')#,#dateFormat(dDOB, 'mm/dd/yyyy')#,'#vZipcode#','#vAssessmenttype#','#vAssessmentstatus#','#vNycwayappointmentcode#',#dateFormat(dAssessmentStart, 'mm/dd/yyyy')#, #tAppointmentTime#,'#vCasacworker#','#vApprovingsupervisor#','#vBenefitstatus_casetype#','#vFinalrecommendation#','#vSitecode#','#dReassessment#','#vCurrentlivingsituation#','#vMentalconditions#','#vCandidateforwecare#','#vAttendsubstanceuse#','#vAgencyname#','#vTreatmentprogramname#','#vTypeoftreatment#','#vOpioidtaken#','#iHousingoutcome#','#vReturntotreatmentprovider#','#vNonhraapproved#','#vNamenonhrasite#','#vNewhramandate#','#vTransfertonewtreatmentprovider#', #tCheckin#, #tAssessmentStart#, #tCheckouttime#,'#vCheckedinsite#','#vAddendum#','#vConsentbsigned#'] />
        <cfset arrThisRowSACAPValues = ['SACAP','#sacap_clientLName#','#sacap_clientFName#','#sacap_ssn#','#sacap_gender#','#vHRAClientId#',#dateFormat(vAge, 'mm/dd/yyyy')#,'#vClientPermZip#','#sacap_StarsAssessmentType#',' ',#sacap_clienttype#,#dateFormat(dCasacDate, 'mm/dd/yyyy')#,#tScheduledtime#,'#vEmpFName# #vEmpLName#','#supervisor_fname# #supervisor_lname#','#sacap_benefitstatus#','#sacap_finalRecommendation#','#vHRACode#','#sacap_reassessment#',' ','#vMHdiagnoses#','#sacap_wecaretype#',' ','#sacap_projects#',' ',' ','#sacap_buprenorphine#','#sacap_housingstatus#','#sacap_encounteroutcome#','#sacap_nonhraapproved#','#sacap_namenonhrasite#','#isNewlyMandated#','#sacap_transferreason#', #tTimeInBin#, #tApptBeginTime#, #tApptEndTime#,'#sacap_sacapsite#',' ',' '] />

        <!---This method of populating the spreadsheet is necessary; with spreadsheetAddRow(), commas in values will be interpreted as a new column, even if the value is wrapped in single-quotes, and this screws everything up--->
        <cfset currentSpreadSheetRow = currentSpreadSheetRow + 1 />

        <!---STARS Row--->
        <cfloop from="1" to="39" index="x">
            <cfset spreadsheetSetCellValue(s,arrThisRowSTARSValues[x],currentSpreadSheetRow,x) />
        </cfloop>

        <cfset currentSpreadSheetRow = currentSpreadSheetRow + 1 />

        <!---THIS IS WHERE IT HANGS, ON THE VERY FIRST ITERATION OF QRECONCILED. CPU IS PINNED AT 100%--->
        <!---SACAP Row--->
        <cfloop from="1" to="39" index="x">
            <cfset spreadsheetSetCellValue(s,arrThisRowSACAPValues[x],currentSpreadSheetRow,x) />
        </cfloop>

        <!---Blank Row--->
        <cfset spreadsheetAddRow(s, "") />

        <cfset currentSpreadSheetRow = currentSpreadSheetRow + 1 />

    </cfloop>

    <cfheader name="content-disposition" value="attachment; filename=#vFileName#_Reconciled.xls">
    <cfcontent type="application/msexcel" variable="#spreadsheetReadBinary(s)#" reset="true">

我考虑过使用Ben Nadel的POI实用程序cfc,在这种情况下我会创建一个新查询并按照我填充电子表格的方式填充它(3行为qReconciled中每1行),并将查询提供给writeSingleExcel()。

1 个答案:

答案 0 :(得分:0)

是的,使用POI实用程序cfc清除了问题。以前运行30分钟和超时的东西现在只需要大约90秒。我已经发布了上述页面的新代码,以及我创建的新cfc函数,如下所示。

我所做的代替使用电子表格对象的方法是创建一个新的查询对象,循环遍历qReconciled,并为该查询对象中的39列中的每一列填充一个数组。通过每次循环迭代,所有39个数组都获得了一个&#34; STARS&#34;排,&#34; SACAP&#34;行和一个空行。然后,一旦完成所有迭代,我使用queryAddColumn()填充查询对象中的所有列,然后将该查询提供给poiUtility.writeSingleExcel()。然后,excel文件将保存到服务器上的文件夹中,但也可以通过cfheader / cfcontent标记自动下载到用户的计算机上。

行动页面:     

<!---Originally used cf spreadsheet object to create Excel Export.
But this method used up too much memory; page would hang indefinitely on Production. Now using Ben Nadel's POI Utility instead.--->

<!---dates for from and to come in the format "yyyy-mm-dd"--->
<!---NOTE- if doing a date range without a specific importId, include ImportId as one of the columns in the report--->


<cfif len(trim(url.from & url.to)) AND NOT ( isDate(url.from) AND isDate(url.to) )>
    <cfset url.from = "" />
    <cfset url.to = "" />
</cfif>

<cfset vImportName = "" />
<cfset vDateTitle = "" />
<cfset oStarsImporter = CreateObject("component", "#application.cfcpath#.starsImporter") />
<cfset oPOI = CreateObject("component", "#application.cfcpath#.poiUtility").init() />
<cfset qReconciled = oStarsImporter.getReconciled(url.from, url.to) />

<cfset qDisplay = oStarsImporter.prepForExport(qReconciled) />

<cfif isDate(url.from) AND isDate(url.to)>
    <cfif len(trim(vImportName))>
        <cfset vImportName = vImportname & "-" />
    </cfif>
    <cfset vDateTitle = "From_" & dateFormat(url.from, "mm-dd-yyyy") & "_to_" & dateFormat(url.to, "mm-dd-yyyy") />
</cfif>

<cfset vFileName = vImportName & vDateTitle />

<cfif NOT len(trim(vFileName))>
    <cfset vFileName = "All_reconciled_" & dateFormat(now(), "mm-dd-yyyy") />
<cfelse>
    <cfset vFileName = vFileName & "_reconciled" />
</cfif>

<cfset oPOI.WriteSingleExcel(
    FilePath=application.starsExportDirectory & vFileName & ".xls"
    ,query=qDisplay
    ,columnList="Assessment_Source,Client_Last,Client_First,SSN,Gender,Client_Case_Number,DoB,Zip_Code,Assessment_Type,Assessment_Status,NYCWAY_Appt_Code,Appt_Date,Appt_Time,CASAC_Worker,Approving_Supervisor,Benefit_Status_Case_Type,Final_Recommendation,Site_Code,Re_Assessment,Current_Living_Situation,Mental_Conditions,Candidate_for_WeCARE,Attend_Substance_Use,Agency_Name,Currently_Attending_Treatment_Program_Name,Type_of_Treatment,Opioid_Taken,Housing_Outcome,Return_to_Treatment_Provider,Non_HRA_Approved,Name_non_HRA_Site,New_Mandate,Transfer_to_New_Treatment_Provider,Check_in,Assessment_Start,Checked_Out_Time,Checked_in_Site,Addendum,Consent_B_signed"
    ,columnNames="Assessment Source,Client Last,Client First,SSN,Gender,Client Case Number,DoB,Zip Code,Assessment Type,Assessment Status,NYCWAY Appt Code,Appt Date,Appt Time,CASAC Worker,Approving Supervisor,Benefit Status (Case Type),Final Recommendation,Site Code,Re-Assessment,Current Living Situation,Mental Conditions,Candidate for WeCARE,Attend Substance Use,Agency Name,Currently Attending Treatment Program Name,Type of Treatment,Opioid Taken,Housing Outcome,Return to Treatment Provider,Non HRA-Approved,Name non-HRA Site,New Mandate,Transfer to New Treatment Provider,Check-in,Assessment Start,Checked Out Time,Checked-in Site,Addendum,Consent B signed"
)/>

<cfheader name="Content-Disposition" value="inline; filename=#vFileName#.xls"> 
<cfcontent type="application/vnd.ms-excel" file="#application.starsExcelExportURL##vFileName#.xls">

prepForExport():

<cffunction name="prepForExport" returntype="query" hint="Preps query of reconciled assessments for Excel export">
        <cfargument name="qReconciled" type="query" required="true" />

        <cfset var qryRet = queryNew("") />
        <cfset var arrAssessmentSource = arrayNew(1) />
        <cfset var arrClientLast = arrayNew(1) />
        <cfset var arrClientFirst = arrayNew(1) />
        <cfset var arrSSN = arrayNew(1) />
        <cfset var arrGender = arrayNew(1) />
        <cfset var arrCaseNumber = arrayNew(1) />
        <cfset var arrDob = arrayNew(1) />
        <cfset var arrZip = arrayNew(1) />
        <cfset var arrAssessmentType = arrayNew(1) />
        <cfset var arrAssessmentStatus = arrayNew(1) />
        <cfset var arrNYCApptCode = arrayNew(1) />
        <cfset var arrApptDate = arrayNew(1) />
        <cfset var arrApptTime = arrayNew(1) />
        <cfset var arrCasacWorker = arrayNew(1) />
        <cfset var arrApprovingSup = arrayNew(1) />
        <cfset var arrBenStatus = arrayNew(1) />
        <cfset var arrFinalRecommend = arrayNew(1) />
        <cfset var arrSiteCode = arrayNew(1) />
        <cfset var arrReAssess = arrayNew(1) />
        <cfset var arrLivingSit = arrayNew(1) />
        <cfset var arrMentalCond = arrayNew(1) />
        <cfset var arrCandidateWecare = arrayNew(1) />
        <cfset var arrAttendSubsUse = arrayNew(1) />
        <cfset var arrAgencyname = arrayNew(1) />
        <cfset var arrCurrentTxProg = arrayNew(1) />
        <cfset var arrTypeTx = arrayNew(1) />
        <cfset var arrOpioid = arrayNew(1) />
        <cfset var arrHousingOutcome = arrayNew(1) />
        <cfset var arrReturnToTxProv = arrayNew(1) />
        <cfset var arrNonHRAApproved = arrayNew(1) />
        <cfset var arrNameNonHRASite = arrayNew(1) />
        <cfset var arrNewMandate = arrayNew(1) />
        <cfset var arrXferToNewTxprov = arrayNew(1) />
        <cfset var arrCheckIn = arrayNew(1) />
        <cfset var arrAssessmentStart = arrayNew(1) />
        <cfset var arrCheckOut = arrayNew(1) />
        <cfset var arrCheckedInSite = arrayNew(1) />
        <cfset var arrAddendum = arrayNew(1) />
        <cfset var arrConsentBSigned = arrayNew(1) />
        <cfset var tCheckin = "" />
        <cfset var tAssessmentStart = "" />
        <cfset var tCheckouttime = "" />
        <cfset var tTimeInBin = "" />
        <cfset var tApptBeginTime = "" />
        <cfset var tApptEndTime = "" />
        <cfset var tAppointmentTime = "" />
        <cfset var tScheduledTime = "" />

        <!---populate qryRet by inserting 3 rows for every row in qReconciled: one for STARS, one for SACAP, and one blank row as a seperator--->

        <cfloop query="arguments.qReconciled">
            <cfset tCheckin = timeformat(dcheckin,'short') />
            <cfset tAssessmentStart = timeformat(dAssessmentStart,'short') />
            <cfset tCheckouttime = timeformat(dCheckouttime,'short') />
            <cfset tTimeInBin = timeformat(timeInBin,'short') />
            <cfset tApptBeginTime = timeformat(dApptBeginTime,'short') />
            <cfset tApptEndTime = timeformat(dApptEndTime,'short') />
            <cfset tAppointmentTime = timeformat(dAppointmentdate,'short') />
            <cfset tScheduledTime = timeformat(scheduledTime, 'short') />

            <cfset arrayAppend(arrAssessmentSource, 'STARS') />
            <cfset arrayAppend(arrAssessmentSource, 'SACAP') />
            <cfset arrayAppend(arrAssessmentSource, '') /> 

            <cfset arrayAppend(arrClientLast, vClientlname) />
            <cfset arrayAppend(arrClientLast, sacap_clientLName) />
            <cfset arrayAppend(arrClientLast, '') />

            <cfset arrayAppend(arrClientFirst, vClientfname) />
            <cfset arrayAppend(arrClientFirst, sacap_clientFName) />
            <cfset arrayAppend(arrClientFirst, '') />

            <cfset arrayAppend(arrSSN, vSSN) />
            <cfset arrayAppend(arrSSN, sacap_ssn) />
            <cfset arrayAppend(arrSSN, '') />

            <cfset arrayAppend(arrGender, vGender) />
            <cfset arrayAppend(arrGender, sacap_gender) />
            <cfset arrayAppend(arrGender, '') />

            <cfset arrayAppend(arrCaseNumber, listFirst(vClientcasenumber, '-')) />
            <cfset arrayAppend(arrCaseNumber, vHRAClientId) />
            <cfset arrayAppend(arrCaseNumber, '') />

            <cfset arrayAppend(arrDob, dateFormat(dDOB, 'mm/dd/yyyy')) />
            <cfset arrayAppend(arrDob, dateFormat(vAge, 'mm/dd/yyyy')) />
            <cfset arrayAppend(arrDob, '') />

            <cfset arrayAppend(arrZip, vZipcode) />
            <cfset arrayAppend(arrZip, vClientPermZip) />
            <cfset arrayAppend(arrZip, '') />

            <cfset arrayAppend(arrAssessmentType, vAssessmenttype) />
            <cfset arrayAppend(arrAssessmentType, sacap_StarsAssessmentType) />
            <cfset arrayAppend(arrAssessmentType, '') />

            <cfset arrayAppend(arrAssessmentStatus, vAssessmentstatus) />
            <cfset arrayAppend(arrAssessmentStatus, '') />
            <cfset arrayAppend(arrAssessmentStatus, '') />

            <cfset arrayAppend(arrNYCApptCode, vNycwayappointmentcode) />
            <cfset arrayAppend(arrNYCApptCode, sacap_clienttype) />
            <cfset arrayAppend(arrNYCApptCode, '') />

            <cfset arrayAppend(arrApptDate, dateFormat(dAssessmentStart, 'mm/dd/yyyy')) />
            <cfset arrayAppend(arrApptDate, dateFormat(dCasacDate, 'mm/dd/yyyy')) />
            <cfset arrayAppend(arrApptDate, '') />

            <cfset arrayAppend(arrApptTime, tAppointmentTime) />
            <cfset arrayAppend(arrApptTime, tScheduledtime) />
            <cfset arrayAppend(arrApptTime, '') />

            <cfset arrayAppend(arrCasacWorker, vCasacworker) />
            <cfset arrayAppend(arrCasacWorker, vEmpFName & ' ' & vEmpLName) />
            <cfset arrayAppend(arrCasacWorker, '') />

            <cfset arrayAppend(arrApprovingSup, vApprovingsupervisor) />
            <cfset arrayAppend(arrApprovingSup, supervisor_fname & ' ' & supervisor_lname) />
            <cfset arrayAppend(arrApprovingSup, '') />


            <cfset arrayAppend(arrBenStatus, vBenefitstatus_casetype) />
            <cfset arrayAppend(arrBenStatus, sacap_benefitstatus) />
            <cfset arrayAppend(arrBenStatus, '') />

            <cfset arrayAppend(arrFinalRecommend, vFinalrecommendation) />
            <cfset arrayAppend(arrFinalRecommend, sacap_finalRecommendation) />
            <cfset arrayAppend(arrFinalRecommend, '') />

            <cfset arrayAppend(arrSiteCode, vSitecode) />
            <cfset arrayAppend(arrSiteCode, vHRACode) />
            <cfset arrayAppend(arrSiteCode, '') />

            <cfset arrayAppend(arrReAssess, dReassessment) />
            <cfset arrayAppend(arrReAssess, sacap_reassessment) />
            <cfset arrayAppend(arrReAssess, '') />

            <cfset arrayAppend(arrLivingSit, vCurrentlivingsituation) />
            <cfset arrayAppend(arrLivingSit, '') />
            <cfset arrayAppend(arrLivingSit, '') />

            <cfset arrayAppend(arrMentalCond, vMentalconditions) />
            <cfset arrayAppend(arrMentalCond, vMHdiagnoses) />
            <cfset arrayAppend(arrMentalCond, '') />

            <cfset arrayAppend(arrCandidateWecare, vCandidateforwecare) />
            <cfset arrayAppend(arrCandidateWecare, sacap_wecaretype) />
            <cfset arrayAppend(arrCandidateWecare, '') />

            <cfset arrayAppend(arrAttendSubsUse, vAttendsubstanceuse) />
            <cfset arrayAppend(arrAttendSubsUse, '') />
            <cfset arrayAppend(arrAttendSubsUse, '') />

            <cfset arrayAppend(arrAgencyname, vAgencyname) />
            <cfset arrayAppend(arrAgencyname, sacap_projects) />
            <cfset arrayAppend(arrAgencyname, '') />

            <cfset arrayAppend(arrCurrentTxProg, vTreatmentprogramname) />
            <cfset arrayAppend(arrCurrentTxProg, '') />
            <cfset arrayAppend(arrCurrentTxProg, '') />

            <cfset arrayAppend(arrTypeTx, vTypeoftreatment) />
            <cfset arrayAppend(arrTypeTx, '') />
            <cfset arrayAppend(arrTypeTx, '') />

            <cfset arrayAppend(arrOpioid, vOpioidtaken) />
            <cfset arrayAppend(arrOpioid, sacap_buprenorphine) />
            <cfset arrayAppend(arrOpioid, '') />

            <cfset arrayAppend(arrHousingOutcome, iHousingoutcome) />
            <cfset arrayAppend(arrHousingOutcome, sacap_housingstatus) />
            <cfset arrayAppend(arrHousingOutcome, '') />

            <cfset arrayAppend(arrReturnToTxProv, vReturntotreatmentprovider) />
            <cfset arrayAppend(arrReturnToTxProv, sacap_encounteroutcome) />
            <cfset arrayAppend(arrReturnToTxProv, '') />

            <cfset arrayAppend(arrNonHRAApproved, vNonhraapproved) />
            <cfset arrayAppend(arrNonHRAApproved, sacap_nonhraapproved) />
            <cfset arrayAppend(arrNonHRAApproved, '') />

            <cfset arrayAppend(arrNameNonHRASite, vNamenonhrasite) />
            <cfset arrayAppend(arrNameNonHRASite, sacap_namenonhrasite) />
            <cfset arrayAppend(arrNameNonHRASite, '') />

            <cfset arrayAppend(arrNewMandate, vNewhramandate) />
            <cfset arrayAppend(arrNewMandate, iSNewlyMandated) />
            <cfset arrayAppend(arrNewMandate, '') />

            <cfset arrayAppend(arrXferToNewTxprov, vTransfertonewtreatmentprovider) />
            <cfset arrayAppend(arrXferToNewTxprov, sacap_transferreason) />
            <cfset arrayAppend(arrXferToNewTxprov, '') />

            <cfset arrayAppend(arrCheckIn, tCheckin) />
            <cfset arrayAppend(arrCheckIn, tTimeInBin) />
            <cfset arrayAppend(arrCheckIn, '') />

            <cfset arrayAppend(arrAssessmentStart, tAssessmentStart) />
            <cfset arrayAppend(arrAssessmentStart, tApptBeginTime) />
            <cfset arrayAppend(arrAssessmentStart, '') />

            <cfset arrayAppend(arrCheckOut, tCheckouttime) />
            <cfset arrayAppend(arrCheckOut, tApptEndTime) />
            <cfset arrayAppend(arrCheckOut, '') />

            <cfset arrayAppend(arrCheckedInSite, vCheckedinsite) />
            <cfset arrayAppend(arrCheckedInSite, sacap_sacapsite) />
            <cfset arrayAppend(arrCheckedInSite, '') />

            <cfset arrayAppend(arrAddendum, vAddendum) />
            <cfset arrayAppend(arrAddendum, '') />
            <cfset arrayAppend(arrAddendum, '') />

            <cfset arrayAppend(arrConsentBSigned, vConsentbsigned) />
            <cfset arrayAppend(arrConsentBSigned, '') />
            <cfset arrayAppend(arrConsentBSigned, '') />
        </cfloop>

        <cfset queryAddColumn(qryRet, "Assessment_Source", "varchar", arrAssessmentSource) />
        <cfset queryAddColumn(qryRet, "Client_Last", "varchar", arrClientLast) />
        <cfset queryAddColumn(qryRet, "Client_First","varchar", arrClientFirst) />
        <cfset queryAddColumn(qryRet, "SSN", "varchar", arrSSN) />
        <cfset queryAddColumn(qryRet, "Gender", "varchar", arrGender) />
        <cfset queryAddColumn(qryRet, "Client_Case_Number", "varchar", arrCaseNumber) />
        <cfset queryAddColumn(qryRet, "DoB", "varchar", arrDob) />
        <cfset queryAddColumn(qryRet, "Zip_Code", "varchar", arrZip) />
        <cfset queryAddColumn(qryRet, "Assessment_Type", "varchar", arrAssessmentType) />
        <cfset queryAddColumn(qryRet, "Assessment_Status", "varchar", arrAssessmentStatus) />
        <cfset queryAddColumn(qryRet, "NYCWAY_Appt_Code", "varchar", arrNYCApptCode) />
        <cfset queryAddColumn(qryRet, "Appt_Date", "varchar", arrApptDate) />
        <cfset queryAddColumn(qryRet, "Appt_Time", "varchar", arrApptTime) />
        <cfset queryAddColumn(qryRet, "CASAC_Worker", "varchar", arrCasacWorker) />
        <cfset queryAddColumn(qryRet, "Approving_Supervisor", "varchar", arrApprovingSup) />
        <cfset queryAddColumn(qryRet, "Benefit_Status_Case_Type", "varchar", arrBenStatus) />
        <cfset queryAddColumn(qryRet, "Final_Recommendation", "varchar", arrFinalRecommend) />
        <cfset queryAddColumn(qryRet, "Site_Code", "varchar", arrSiteCode) />
        <cfset queryAddColumn(qryRet, "Re_Assessment", "varchar", arrReAssess) />
        <cfset queryAddColumn(qryRet, "Current_Living_Situation", "varchar", arrLivingSit) />
        <cfset queryAddColumn(qryRet, "Mental_Conditions", "varchar", arrMentalCond) />
        <cfset queryAddColumn(qryRet, "Candidate_for_WeCARE", "varchar", arrCandidateWecare) />
        <cfset queryAddColumn(qryRet, "Attend_Substance_Use", "varchar", arrAttendSubsUse) />
        <cfset queryAddColumn(qryRet, "Agency_Name", "varchar", arrAgencyname) />
        <cfset queryAddColumn(qryRet, "Currently_Attending_Treatment_Program_Name", "varchar", arrCurrentTxProg) />
        <cfset queryAddColumn(qryRet, "Type_of_Treatment", "varchar", arrTypeTx) />
        <cfset queryAddColumn(qryRet, "Opioid_Taken", "varchar", arrOpioid) />
        <cfset queryAddColumn(qryRet, "Housing_Outcome", "varchar", arrHousingOutcome) />
        <cfset queryAddColumn(qryRet, "Return_to_Treatment_Provider", "varchar", arrReturnToTxProv) />
        <cfset queryAddColumn(qryRet, "Non_HRA_Approved", "varchar", arrNonHRAApproved) />
        <cfset queryAddColumn(qryRet, "Name_non_HRA_Site", "varchar", arrNameNonHRASite) />
        <cfset queryAddColumn(qryRet, "New_Mandate", "varchar", arrNewMandate) />
        <cfset queryAddColumn(qryRet, "Transfer_to_New_Treatment_Provider", "varchar", arrXferToNewTxprov) />
        <cfset queryAddColumn(qryRet, "Check_in", "varchar", arrCheckIn) />
        <cfset queryAddColumn(qryRet, "Assessment_Start", "varchar", arrAssessmentStart) />
        <cfset queryAddColumn(qryRet, "Checked_Out_Time", "varchar", arrCheckOut) />
        <cfset queryAddColumn(qryRet, "Checked_in_Site", "varchar", arrCheckedInSite) />
        <cfset queryAddColumn(qryRet, "Addendum", "varchar", arrAddendum) />
        <cfset queryAddColumn(qryRet, "Consent_B_signed", "varchar", arrConsentBSigned) />

        <cfreturn qryRet />

    </cffunction>