如何防止 CF 电子表格人口挂起?

How to keep CF spreadsheet population from hanging?

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

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

查询 qReconciled 没有问题(大约有 2,200 行);我 运行 在 SQL Server studio 的开发和生产环境中进行查询,在这两种情况下 运行.

只花了大约一分钟

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

<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 Utility cfc,在这种情况下,我会创建一个新查询并按照填充电子表格的方式填充它(qReconciled 中每 1 行对应 3 行),并且将查询提供给 writeSingleExcel()。

是的,使用 POI Utility cfc 解决了问题。以前 运行 30 分钟超时现在只需要大约 90 秒。我已经为上面的页面发布了新代码,并在下面发布了我创建的新 cfc 函数。

我没有使用电子表格对象,而是创建了一个新的查询对象,遍历 qReconciled,并为该查询对象中的 39 列中的每一列填充一个数组。在每次循环迭代中,所有 39 个数组都会获得 "STARS" 行、"SACAP" 行和空白行的值。然后,在完成所有迭代后,我使用 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>