CFspreadsheet adding a % to format a column - coldfusion

I am using CF10 and trying to add a % sign to a spreadsheet.
I am having an issue with adding a % sign on my 5th column entries. (Only the entries starting the second row (not the header) and not the blank cells when the query is done running.
<cftry>
<cfset objSpreadsheet = SpreadsheetNew()>
<cfset assocRows = ''>
<!--- Create and format the header row. --->
<cfset SpreadsheetAddRow( objSpreadsheet, "Associate Name,Location,Checklists Generated by Associate,Checklists Generated by Selected Location(s),Associate Percentage of Location Total" )>
<cfset rowNumber = 1 />
<cfoutput query="GetEmployeeInfo">
<cfset rowNumber++ />
<cfset rowList = "'#(rnA eq 1)?assoc_name:''#','#(rnl eq 1)?trans_location:''#','#checklistsByAssocLoc#','#assocChecklistsByLoc#','#DecimalFormat(totalChecklistsByAssocLocPct)#'">
<!--- Make list of rows --->
<cfif (rnA eq 1)>
<cfset assocRows = ListAppend(assocRows, rowNumber)>
</cfif>
<cfset SpreadsheetAddRow( objSpreadsheet, rowList)>
<cfif rnTotAssoc EQ 1>
<cfset rowNumber++ />
<cfset rowList = "'Associate Total','','#totalChecklistsByAssoc#','#totalAssocChecklistsByAllFilteredLoc#','#DecimalFormat(totalChecklistsByLocPct)#'" >
<cfset SpreadsheetAddRow( objSpreadsheet, rowList )>
</cfif>
</cfoutput>
<cfset SpreadSheetSetColumnWidth(objSpreadsheet,1,25)>
<cfset SpreadSheetSetColumnWidth(objSpreadsheet,2,25)>
<cfset SpreadSheetSetColumnWidth(objSpreadsheet,3,25)>
<cfset SpreadSheetSetColumnWidth(objSpreadsheet,4,25)>
<cfset SpreadSheetSetColumnWidth(objSpreadsheet,5,25)>
<!--- Move the line here --->
<cfset SpreadsheetFormatRow( objSpreadsheet, {bold=true, textwrap="true", alignment="center"}, 1 )>
<cfloop list="#assocRows#" index="i">
<cfset SpreadsheetFormatCell(objSpreadsheet, {'bold' : 'true'}, i, 1)>
</cfloop>
<cfheader name="Content-Disposition" value="inline; filename=CS_#Dateformat(NOW(),'MMDDYYYY')#.xls">
<cfcontent type="application/vnd.ms-excel" variable="#SpreadsheetReadBinary( objSpreadsheet )#">
<cfcatch type = "any">
#rowList#
<cfabort>
</cfcatch>
</cftry>
I have tried adding:
'#DecimalFormat(totalChecklistsByLocPct)# %'"
which then excel doesnt know the correct format.
Then I tried:
<cfset spreadsheetFormatCell( objSpreadsheet, {dataformat: "0.00%"}, 2 )>
Which then just through an error:
Parameter validation error for the SPREADSHEETFORMATCELL function.
Any help on how to add this % sign to the 5 column (not the header or blank cells once the query stops) would be greatly appreciated.
EDIT
Also tried:
<cfset rowList = "'#(rnA eq 1)?assoc_name:''#','#(rnl eq 1)?trans_location:''#','#checklistsByAssocLoc#','#assocChecklistsByLoc#','#NumberFormat(totalChecklistsByAssocLocPct, '0.00')# %'">
Excel still through the error saying its formatted as text.

Related

cfspreadsheet making first item in row bold

I have a rowlist using cfspreadsheet in ColdFusion10.
<cfset rowList = "'#(rnA eq 1)?assoc_name:''#','#(rnl eq 1)?trans_location:''#','#checklistsByAssocLoc#','#assocChecklistsByLoc#','#DecimalFormat(totalChecklistsByAssocLocPct)#'">
I am trying to make this portion bold.
'#(rnA eq 1)?assoc_name:''#',
I have tried cfif statements and nothing seems to give me the result I need to make my names bold.
Any help with this would be greatly appreciated.
EDIT
My entire spreadsheet
<cftry>
<cfset objSpreadsheet = SpreadsheetNew()>
<!--- Create and format the header row. --->
<cfset SpreadsheetAddRow( objSpreadsheet, "Associate Name,Location,Checklists Generated by Associate,Checklists Generated by Selected Location(s),Associate Percentage of Location Total" )>
<cfset SpreadsheetFormatRow( objSpreadsheet, {bold=true, textwrap="true", alignment="center"}, 1 )>
<cfset rowNumber = 0 />
<cfoutput query="GetEmployeeInfo">
<cfset rowNumber++ />
<cfset rowList = "'#(rnA eq 1)?assoc_name:''#','#(rnl eq 1)?trans_location:''#','#checklistsByAssocLoc#','#assocChecklistsByLoc#','#DecimalFormat(totalChecklistsByAssocLocPct)#'">
<cfset SpreadsheetAddRow( objSpreadsheet, rowList)>
<cfset SpreadsheetFormatColumn(objSpreadsheet, {'bold' : 'true'}, 1)>
<!---<cfset spreadsheetFormatCell( objSpreadsheet, {bold: true}, rowNumber, 1 )>--->
<cfif rnTotAssoc EQ 1>
<cfset rowNumber++ />
<cfset rowList = "'Associate Total','','#totalChecklistsByAssoc#','#totalAssocChecklistsByAllFilteredLoc#','#DecimalFormat(totalChecklistsByLocPct)#'" >
<cfset SpreadsheetAddRow( objSpreadsheet, rowList )>
</cfif>
</cfoutput>
<cfset SpreadSheetSetColumnWidth(objSpreadsheet,1,25)>
<cfset SpreadSheetSetColumnWidth(objSpreadsheet,2,25)>
<cfset SpreadSheetSetColumnWidth(objSpreadsheet,3,25)>
<cfset SpreadSheetSetColumnWidth(objSpreadsheet,4,25)>
<cfset SpreadSheetSetColumnWidth(objSpreadsheet,5,25)>
<cfheader name="Content-Disposition" value="inline; filename=CS_#Dateformat(NOW(),'MMDDYYYY')#.xls">
<cfcontent type="application/vnd.ms-excel" variable="#SpreadsheetReadBinary( objSpreadsheet )#">
<cfcatch type = "any">
#rowList#
<cfabort>
</cfcatch>
</cftry>
You can use the following after all the rows are included.
<cftry>
<cfset objSpreadsheet = SpreadsheetNew()>
<cfset assocRows = ''>
<!--- Create and format the header row. --->
<cfset SpreadsheetAddRow( objSpreadsheet, "Associate Name,Location,Checklists Generated by Associate,Checklists Generated by Selected Location(s),Associate Percentage of Location Total" )>
<cfset rowNumber = 1 />
<cfoutput query="GetEmployeeInfo">
<cfset rowNumber++ />
<cfset rowList = "'#(rnA eq 1)?assoc_name:''#','#(rnl eq 1)?trans_location:''#','#checklistsByAssocLoc#','#assocChecklistsByLoc#','#DecimalFormat(totalChecklistsByAssocLocPct)#'">
<!--- Make list of rows --->
<cfif (rnA eq 1)>
<cfset assocRows = ListAppend(assocRows, rowNumber)>
</cfif>
<cfset SpreadsheetAddRow( objSpreadsheet, rowList)>
<cfif rnTotAssoc EQ 1>
<cfset rowNumber++ />
<cfset rowList = "'Associate Total','','#totalChecklistsByAssoc#','#totalAssocChecklistsByAllFilteredLoc#','#DecimalFormat(totalChecklistsByLocPct)#'" >
<cfset SpreadsheetAddRow( objSpreadsheet, rowList )>
</cfif>
</cfoutput>
<cfset SpreadSheetSetColumnWidth(objSpreadsheet,1,25)>
<cfset SpreadSheetSetColumnWidth(objSpreadsheet,2,25)>
<cfset SpreadSheetSetColumnWidth(objSpreadsheet,3,25)>
<cfset SpreadSheetSetColumnWidth(objSpreadsheet,4,25)>
<cfset SpreadSheetSetColumnWidth(objSpreadsheet,5,25)>
<!--- Move the line here --->
<cfset SpreadsheetFormatRow( objSpreadsheet, {bold=true, textwrap="true", alignment="center"}, 1 )>
<cfloop list="#assocRows#" index="i">
<cfset SpreadsheetFormatCell(objSpreadsheet, {'bold' : 'true'}, i, 1)>
</cfloop>
<cfheader name="Content-Disposition" value="inline; filename=CS_#Dateformat(NOW(),'MMDDYYYY')#.xls">
<cfcontent type="application/vnd.ms-excel" variable="#SpreadsheetReadBinary( objSpreadsheet )#">
<cfcatch type = "any">
#rowList#
<cfabort>
</cfcatch>
</cftry>

Column Formatting cfspreadsheet

I am using cfspreadheet in ColdFusion 10. I am aligning my 5th column to the right. Columns 1 through 44 align right then 44 through 73 start aligning left again. Is this typical when trying to format a spreadsheet?
<cfset SpreadsheetFormatColumn( objSpreadsheet, {alignment="right"}, 5 )>
All the spreadsheet code:
<cftry>
<cfset objSpreadsheet = SpreadsheetNew()>
<cfset assocRows = ''>
<!--- Create and format the header row. --->
<cfset SpreadsheetAddRow( objSpreadsheet, "Associate Name,Location,Checklists Generated by Associate,Checklists Generated by Selected Location(s),Associate Percentage of Location Total" )>
<cfset rowNumber = 1 />
<cfoutput query="GetEmployeeInfo">
<cfset rowNumber++ />
<cfset rowList = "'#(rnA eq 1)?assoc_name:''#','#(rnl eq 1)?trans_location:''#','#checklistsByAssocLoc#','#assocChecklistsByLoc#','#DecimalFormat(totalChecklistsByAssocLocPct)#%'">
<!--- Make list of rows --->
<cfif (rnA eq 1)>
<cfset assocRows = ListAppend(assocRows, rowNumber)>
</cfif>
<cfset SpreadsheetAddRow( objSpreadsheet, rowList)>
<cfif rnTotAssoc EQ 1>
<cfset rowNumber++ />
<cfset rowList = "'Associate Total','','#totalChecklistsByAssoc#','#totalAssocChecklistsByAllFilteredLoc#','#DecimalFormat(totalChecklistsByLocPct)#%'" >
<cfset SpreadsheetAddRow( objSpreadsheet, rowList )>
</cfif>
</cfoutput>
<cfset SpreadSheetSetColumnWidth(objSpreadsheet,1,25)>
<cfset SpreadSheetSetColumnWidth(objSpreadsheet,2,25)>
<cfset SpreadSheetSetColumnWidth(objSpreadsheet,3,25)>
<cfset SpreadSheetSetColumnWidth(objSpreadsheet,4,25)>
<cfset SpreadSheetSetColumnWidth(objSpreadsheet,5,25)>
<!--- Move the line here --->
<cfset SpreadsheetFormatColumn(objSpreadsheet, {alignment="right"}, 5 )>
<cfset SpreadsheetFormatRow(objSpreadsheet, {bold=true, textwrap="true", alignment="center"}, 1 )>
<cfloop list="#assocRows#" index="i">
<cfset SpreadsheetFormatCell(objSpreadsheet, {'bold' : 'true'}, i, 1)>
</cfloop>
<!---<cfset spreadsheetFormatColumn( objSpreadsheet, {dataformat: "0.00%"}, 5 )>--->
<cfheader name="Content-Disposition" value="inline; filename=CS_#Dateformat(NOW(),'MMDDYYYY')#.xls">
<cfcontent type="application/vnd.ms-excel" variable="#SpreadsheetReadBinary( objSpreadsheet )#">
<cfcatch type = "any">
#rowList#
<cfabort>
</cfcatch>
</cftry>
I should add if I remove the percent signs '%' in the decimal format it does align right completely. But I am trying to make it work with the % signs.

Need to see ColdFusion query params being sent and return data

Newbie to ColdFusion.
I have a script that works for all vendors except one. The script passes a few params and receives a list of claims for the specified vendor with the exception of the vendor previously mentioned.
I'd like to debug one function so I can ensure I'm passing the correct params for this one vendor and also see the response being returned for the same vendor.
What's the best way to debug my script?
Are either of these a good option?
<cfdump var="#VARIABLES#">
<cfdump var="#getPageContext().getBuiltInScopes()#"/>
I'm sure you've all had a case where you had to PROVE it's a database issue and not a script issue.
here's the function
<!--- function getAllRenewalRequestsChrisTest for testing --->
<cffunction name="getAllRenewalRequestsChrisTest" access="public" returnType="Query" hint="">
<cfargument name="Domain" type="String" required="true" hint="Domain for Database Identification.">
<cfargument name="Org_ID" type="Numeric" required="true" hint="Org_Id - Primary Key">
<cfargument name="UserKey" type="Numeric" required="true" hint="UserPK - Primary Key">
<cfset var Local = StructNew()>
<cftry>
<cfset Local.ERXInfo = CreateObject("component","cfc.org.Org").getEprescribeStatus("#Arguments.Domain#","#Arguments.Org_ID#")>
<cfset Local.credentials = StructNew()>
<cfset Local.credentials.PartnerName = "#Local.ERXInfo.eRxPartnerName#">
<cfset Local.credentials.Name = "#Local.ERXInfo.eRxName#">
<cfset Local.credentials.Password = "#Local.ERXInfo.eRxPassword#">
<cfset Local.accountRequest = StructNew()>
<cfset Local.accountRequest.AccountId = "#getEMRDataDSN(Arguments.Domain)#-#Arguments.Org_ID#">
<cfset Local.accountRequest.SiteId = "#Local.ERXInfo.eRxSiteId#">
<cfset Local.wsargs = StructNew()>
<cfset Local.wsargs.timeout = 5>
<cfset Local.objWebService = CreateObject("webservice","#getErxServer(Arguments.Domain)#v7/WebServices/Update1.asmx?WSDL", Local.wsargs)>
<cfset Local.objSearchResponse = Local.objWebService.GetAllRenewalRequestsV2 (Local.credentials, Local.accountRequest, "","")>
<cfset Local.qTemp = QueryNew("DoctorFullName,DrugInfo,ExternalPrescriptionId,ExternalDoctorId,NumberOfRefills,PatientDOB,PatientName,FirstName,LastName,MiddleName,PatientGender,ReceivedTimestamp,RenewalRequestGuid,Quantity,Sig,RenewalRequestMed,EcastPharmacyId,EcastPharmacyName,EcastPharmacyInfo,EcastPharmacyInfoToolTip")>
<cfset Local.renewalRequests = Local.objSearchResponse.getRenewalSummaryArray().getRenewalSummaryV2()>
<cfset Local.objPharmacy = CreateObject("component","cfc.pharmacy")>
<cfloop from="1" to="#ArrayLen(Local.renewalRequests)#" index="Local.indexB">
<cfset QueryAddRow(Local.qTemp)>
<cfset QuerySetCell(Local.qTemp, "DoctorFullName", "#Local.renewalRequests[Local.indexB].getDoctorFullName()#")>
<cfset QuerySetCell(Local.qTemp, "DrugInfo", "#Local.renewalRequests[Local.indexB].getDrugInfo()#")>
<cfset QuerySetCell(Local.qTemp, "ExternalPrescriptionId", "#Local.renewalRequests[Local.indexB].getExternalPrescriptionId()#")>
<cfif Trim(Local.renewalRequests[Local.indexB].getExternalDoctorId()) EQ "">
<cfset QuerySetCell(Local.qTemp, "ExternalDoctorId", "0")>
<cfelse>
<cfset QuerySetCell(Local.qTemp, "ExternalDoctorId", "#Trim(Local.renewalRequests[Local.indexB].getExternalDoctorId())#")>
</cfif>
<cfset QuerySetCell(Local.qTemp, "NumberOfRefills", "#Local.renewalRequests[Local.indexB].getNumberOfRefills()#")>
<cfif Len(trim(Local.renewalRequests[Local.indexB].getPatientDOB())) EQ 8>
<cfset QuerySetCell(Local.qTemp, "PatientDOB", "#DateFormat(CreateDate(Left(trim(Local.renewalRequests[Local.indexB].getPatientDOB()), 4), Mid(trim(Local.renewalRequests[Local.indexB].getPatientDOB()), 5, 2), Mid(trim(Local.renewalRequests[Local.indexB].getPatientDOB()), 7, 2)),'mm/dd/yyyy')#")>
<cfelse>
<cfset QuerySetCell(Local.qTemp, "PatientDOB", "#Trim(Local.renewalRequests[Local.indexB].getPatientDOB())#")>
</cfif>
<cfset QuerySetCell(Local.qTemp, "PatientName", "#Local.renewalRequests[Local.indexB].getPatientLastName()#, #Local.renewalRequests[Local.indexB].getPatientFirstName()# #Local.renewalRequests[Local.indexB].getPatientMiddleName()#")>
<cfset QuerySetCell(Local.qTemp, "FirstName", "#Local.renewalRequests[Local.indexB].getPatientFirstName()#")>
<cfset QuerySetCell(Local.qTemp, "LastName", "#Local.renewalRequests[Local.indexB].getPatientLastName()#")>
<cfset QuerySetCell(Local.qTemp, "MiddleName", "#Local.renewalRequests[Local.indexB].getPatientMiddleName()#")>
<cfset QuerySetCell(Local.qTemp, "PatientGender", "#UCase(Local.renewalRequests[Local.indexB].getPatientGender())#")>
<cfset Local.tempPharmacyInfo = Local.objPharmacy.getPharmacyInfoByNCPDID(Arguments.Domain,Arguments.Org_ID,Local.renewalRequests[Local.indexB].getNcpdpID(),0)>
<cfif Local.tempPharmacyInfo.recordcount GT 0><!--- non hidden pharmacy already exists--->
<cfset Local.currentPharmacyInfo = Local.objPharmacy.getPharmacyInfoById(Arguments.Domain,Local.tempPharmacyInfo.Pharmacy_Id)>
<cfif Trim(Local.currentPharmacyInfo.PharmacyDisplayName) NEQ "">
<cfset QuerySetCell(Local.qTemp, "EcastPharmacyName", "#Trim(Local.currentPharmacyInfo.PharmacyDisplayName)#")>
<cfelse>
<cfset QuerySetCell(Local.qTemp, "EcastPharmacyName", "#Trim(Local.currentPharmacyInfo.Pharmacy_Name)#")>
</cfif>
<cfset QuerySetCell(Local.qTemp, "EcastPharmacyId", "#Local.currentPharmacyInfo.Pharmacy_Id#")>
<cfelse>
<cfset Local.tempPharmacyInfo = Local.objPharmacy.getPharmacyInfoByNCPDID(Arguments.Domain,Arguments.Org_ID,Local.renewalRequests[Local.indexB].getNcpdpID(),1)>
<cfif Local.tempPharmacyInfo.recordcount GT 0><!--- hidden pharmacy already exists--->
<cfset Local.currentPharmacyInfo = Local.objPharmacy.getPharmacyInfoById(Arguments.Domain,Local.tempPharmacyInfo.Pharmacy_Id)>
<cfset QuerySetCell(Local.qTemp, "EcastPharmacyId", "#Local.currentPharmacyInfo.Pharmacy_Id#")>
<cfif Trim(Local.currentPharmacyInfo.PharmacyDisplayName) NEQ "">
<cfset QuerySetCell(Local.qTemp, "EcastPharmacyName", "#Trim(Local.currentPharmacyInfo.PharmacyDisplayName)#")>
<cfelse>
<cfset QuerySetCell(Local.qTemp, "EcastPharmacyName", "#Trim(Local.currentPharmacyInfo.Pharmacy_Name)#")>
</cfif>
<cfelse> <!--- add pharmacy to org --->
<cfset Local.tempPharmacyInfo = getPharmacyByNCPDID(Arguments.Domain,Arguments.Org_Id,Local.renewalRequests[Local.indexB].getNcpdpID())>
<cfset Local.newPharmacyId = Local.objPharmacy.setPharmacy(Arguments.domain,Arguments.Org_ID,Arguments.UserKey,Local.tempPharmacyInfo.NAME,Local.tempPharmacyInfo.NAME,Local.tempPharmacyInfo.PHONE,Local.tempPharmacyInfo.FAX,Local.tempPharmacyInfo.ADDRESS,Local.tempPharmacyInfo.CITY,Local.tempPharmacyInfo.ZIP,Local.tempPharmacyInfo.STATE,-1,Local.tempPharmacyInfo.NCPDID,Local.tempPharmacyInfo.PHARMACYTYPE,1)>
<cfset Local.currentPharmacyInfo = Local.objPharmacy.getPharmacyInfoById(Arguments.Domain,Local.newPharmacyId)>
<cfset QuerySetCell(Local.qTemp, "EcastPharmacyId", "#Local.newPharmacyId#")>
<cfif Trim(Local.currentPharmacyInfo.PharmacyDisplayName) NEQ "">
<cfset QuerySetCell(Local.qTemp, "EcastPharmacyName", "#Trim(Local.currentPharmacyInfo.PharmacyDisplayName)#")>
<cfelse>
<cfset QuerySetCell(Local.qTemp, "EcastPharmacyName", "#Trim(Local.currentPharmacyInfo.Pharmacy_Name)#")>
</cfif>
</cfif>
</cfif>
<cfif Trim(Local.currentPharmacyInfo.PharmacyDisplayName) NEQ "">
<cfset QuerySetCell(Local.qTemp, "EcastPharmacyInfoToolTip", "#Trim("Name: #Local.currentPharmacyInfo.PharmacyDisplayName#$SPLIT$Address: #Local.currentPharmacyInfo.Pharmacy_Address# #Local.currentPharmacyInfo.Pharmacy_City# #Local.currentPharmacyInfo.Pharmacy_State# #Local.currentPharmacyInfo.Pharmacy_Zip#$SPLIT$Phone: #Local.currentPharmacyInfo.Pharmacy_Phone#$SPLIT$Fax: #Local.currentPharmacyInfo.Pharmacy_Fax#")#")>
<cfset QuerySetCell(Local.qTemp, "EcastPharmacyInfo", "#Trim("#Local.currentPharmacyInfo.PharmacyDisplayName#$SPLIT$#Local.currentPharmacyInfo.Pharmacy_Address#$SPLIT$#Local.currentPharmacyInfo.Pharmacy_City#, #Local.currentPharmacyInfo.Pharmacy_State# #Local.currentPharmacyInfo.Pharmacy_Zip#$SPLIT$#Local.currentPharmacyInfo.Pharmacy_Phone# (phone)$SPLIT$#Local.currentPharmacyInfo.Pharmacy_Fax# (fax)")#")>
<cfelse>
<cfset QuerySetCell(Local.qTemp, "EcastPharmacyInfoToolTip", "#Trim("Name: #Local.currentPharmacyInfo.Pharmacy_Name#$SPLIT$Address: #Local.currentPharmacyInfo.Pharmacy_Address# #Local.currentPharmacyInfo.Pharmacy_City# #Local.currentPharmacyInfo.Pharmacy_State# #Local.currentPharmacyInfo.Pharmacy_Zip#$SPLIT$Phone: #Local.currentPharmacyInfo.Pharmacy_Phone#$SPLIT$Fax: #Local.currentPharmacyInfo.Pharmacy_Fax#")#")>
<cfset QuerySetCell(Local.qTemp, "EcastPharmacyInfo", "#Trim("#Local.currentPharmacyInfo.Pharmacy_Name#$SPLIT$#Local.currentPharmacyInfo.Pharmacy_Address#$SPLIT$#Local.currentPharmacyInfo.Pharmacy_City#, #Local.currentPharmacyInfo.Pharmacy_State# #Local.currentPharmacyInfo.Pharmacy_Zip#$SPLIT$#Local.currentPharmacyInfo.Pharmacy_Phone# (phone)$SPLIT$#Local.currentPharmacyInfo.Pharmacy_Fax# (fax)")#")>
</cfif>
<cfset QuerySetCell(Local.qTemp, "ReceivedTimestamp", "#Local.renewalRequests[Local.indexB].getReceivedTimestamp()#")>
<cfset QuerySetCell(Local.qTemp, "RenewalRequestGuid", "#Local.renewalRequests[Local.indexB].getRenewalRequestGuid()#")>
<cfset QuerySetCell(Local.qTemp, "Quantity", "#Local.renewalRequests[Local.indexB].getQuantity()#")>
<cfset QuerySetCell(Local.qTemp, "Sig", "#Local.renewalRequests[Local.indexB].getSig()#")>
<cfif Trim(Local.renewalRequests[Local.indexB].getQuantity()) NEQ "" AND Trim(Local.renewalRequests[Local.indexB].getSig()) NEQ "">
<cfset QuerySetCell(Local.qTemp, "RenewalRequestMed", "#Local.renewalRequests[Local.indexB].getDrugInfo()# (#Trim(Local.renewalRequests[Local.indexB].getQuantity())#, #Trim(Local.renewalRequests[Local.indexB].getSig())#)")>
<cfelse>
<cfif Trim(Local.renewalRequests[Local.indexB].getQuantity()) NEQ "">
<cfset QuerySetCell(Local.qTemp, "RenewalRequestMed", "#Local.renewalRequests[Local.indexB].getDrugInfo()# (#Trim(Local.renewalRequests[Local.indexB].getQuantity())#)")>
<cfelse>
<cfset QuerySetCell(Local.qTemp, "RenewalRequestMed", "#Local.renewalRequests[Local.indexB].getDrugInfo()# (#Trim(Local.renewalRequests[Local.indexB].getSig())#)")>
</cfif>
</cfif>
</cfloop>
<cfcatch type="Any">
<cfset Local.qTemp = QueryNew("DoctorFullName,DrugInfo,ExternalPrescriptionId,ExternalDoctorId,NumberOfRefills,PatientDOB,PatientName,FirstName,LastName,MiddleName,PatientGender,ReceivedTimestamp,RenewalRequestGuid,Quantity,Sig,RenewalRequestMed,EcastPharmacyId,EcastPharmacyName,EcastPharmacyInfo,EcastPharmacyInfoToolTip")>
</cfcatch>
</cftry>
<cfreturn Local.qTemp>
<cfdump var="getAllRenewalRequestsChrisTest">
</cffunction>
Are your parameters being passed on the form or url scope? Or do you mean that you have several parameters that are being passed into the query?
It sounds like what you want to do is dump the parameters before they get used (or just after they get passed in) in order to see what they are for your problem vendor.
For instance if your parameters are being passed in the form scope, you could dump the form scope first thing in the script which is supposed to perform the query.
<!--- params passed in via form scope --->
<cfdump var="#form#" output="browser" />
<!--- do query --->
<cfquery name="myVendorData" datasource="...">
... SQL which uses the suspect parameters goes here...
</cfquery>
Does that help?
A code sample would go a long way to helping me give you a better answer.
Turn on Debug Output -> Database Activity

CF: Saving a Fusioncharts graph as an image to email it

Does anyone have an example of this? Google is not my friend tonight. I have the newest version of FusionCharts. I'm trying to figure out how to save a graph as an image file to email it.
I know how to save and then insert images into HTML emails, and I've done this before with other graph products. I just cannot fine 1 good example of how to do this with Fusioncharts.
Thanks!
Use the following code in a template and point the imageSaveURL property at that template.
Your chart submits all necessary data for the chart to be reconstructed. In my example I'm serving it to the browser but you could save it locally and then attach to a cfmail if necessary.
I'm pretty sure I got this from the fusioncharts forums originally. This was updated for fusioncharts 3.1.
<cfif structKeyExists(Form, "width") >
<cfset width = int(Form.width) />
<cfelse>
<cfset width = int(Form.Meta_Width) />
</cfif>
<cfif structKeyExists(Form, "height") >
<cfset height = int(Form.height) />
<cfelse>
<cfset height = int(Form.Meta_Height) />
</cfif>
<cfif structKeyExists(Form, "data") >
<cfset Form.data = Form.data />
<cfelse>
<cfif structKeyExists(Form, "stream") >
<cfset Form.data = Form.stream />
</cfif>
</cfif>
<cfset user = viewState.getValue("user", structNew()) />
<!--- Impose some limits to mitigate DOS attacks --->
<cfif Not (0 lte width and width lte 5000)>
<cfthrow message="Width out of range." />
</cfif>
<cfif Not (0 lte height and height lte 5000)>
<cfthrow message="Height out of range." />
</cfif>
<!--- Check if we have the chart data --->
<cfif Not StructKeyExists(Form, "data") or Not Len(Trim( Form.data ))>
<cfthrow message="Image Data not supplied." />
</cfif>
<!--- Default background color is white --->
<cfif Not StructKeyExists(Form, "bgcolor") or Not Len(Trim( Form.bgcolor ))>
<cfset Form.bgcolor = "FFFFFF" />
</cfif>
<cfset gColor = CreateObject("java", "java.awt.Color") />
<cfset chart = CreateObject("java", "java.awt.image.BufferedImage") />
<cfset chart.init( JavaCast("int", width), JavaCast("int", height), chart.TYPE_3BYTE_BGR) />
<cfset gr = chart.createGraphics() />
<cfset gr.setColor( gColor.decode("##" & Form.bgcolor) ) />
<cfset gr.fillRect(0, 0, JavaCast("int", width), JavaCast("int", height)) />
<!--- Get rows with pixels --->
<cfset rows = ListToArray(Form.data, ";") />
<cfloop from="1" to="#ArrayLen(rows)#" index="i">
<cfset pixels = ListToArray(rows[i], ",") />
<!--- Horizontal index (x scale) --->
<cfset horizIndex = 0 />
<cfloop from="1" to="#ArrayLen(pixels)#" index="j">
<cfif ListLen(pixels[j], "_") eq 2>
<!--- We have the color and the number of times it must be repeated --->
<cfset color = ListGetAt(pixels[j], 1, "_") />
<cfset repeat = ListGetAt(pixels[j], 2, "_") />
<cfelse>
<!--- Background color; how many pixels to skip --->
<cfset color = "" />
<cfset repeat = ListGetAt(pixels[j], 1, "_") />
</cfif>
<cfif Len(Trim(color))>
<!--- If the hexadecimal code is less than 6 characters, prefix with 0 to get a 6 char color --->
<cfif Len(Trim(color)) lt 6>
<cfset color = RepeatString(0, 6 - Len(Trim(color))) & color />
</cfif>
<!--- Draw a horizontal line for the number of pixels we must repeat --->
<cfset gr.setColor(gColor.decode("##" & color)) />
<cfset gr.drawLine(JavaCast("int", horizIndex), JavaCast("int", i - 1), JavaCast("int", horizIndex + repeat -1), JavaCast("int", i - 1)) />
</cfif>
<cfset horizIndex = horizIndex + repeat />
</cfloop>
</cfloop>
<!--- Get writer for Jpeg --->
<cfset writer = "" />
<cfset iter = CreateObject("java", "javax.imageio.ImageIO").getImageWritersByFormatName("jpg") />
<cfloop condition="iter.hasNext()">
<cfset writer = iter.next() />
</cfloop>
<!--- Set Jpeg quality to maximum --->
<cfset jpgParams = CreateObject("java", "javax.imageio.plugins.jpeg.JPEGImageWriteParam").init( CreateObject("java", "java.util.Locale").init("en") ) />
<cfset jpgParams.setCompressionMode( jpgParams.MODE_EXPLICIT ) />
<cfset jpgParams.setCompressionQuality( 1 ) />
<!--- Write image to a memory stream --->
<cfset imageOutput = CreateObject("java", "java.io.ByteArrayOutputStream").init() />
<cfset writer.setOutput( CreateObject("java", "javax.imageio.stream.MemoryCacheImageOutputStream").init( imageOutput ) ) />
<cfset writer.write(JavaCast("null", 0), CreateObject("java", "javax.imageio.IIOImage").init(chart, JavaCast("null", 0), JavaCast("null", 0)), jpgParams) />
<!--- Stream the image to the browser (hint browser to display the Save dialog) --->
<cfset filename="whatever.jpg" />
<cfheader name="Content-Disposition" value="attachment; filename=""#filename#""">
<cfcontent type="image/jpeg" variable="#imageOutput.toByteArray()#">
Checkout out the latest blog post Export Chart Images at Server Side where two options (wkhtmltoimage and PhantomJS. ) has been described with step-by-step instructions for both.
For ColdFusion, you can try the below code:
For example:
<cfexecute name="C:\Program Files\wkhtmltopdf\wkhtmltoimage.exe" arguments="--javascript-delay 10000 http://docs.fusioncharts.com/charts/Code/MyFirstChart/ms-weekly-sales-no-animation.html savedimage.png" />
While executing the above script, we provide the following arguments:
Call wkhtmltoimage
Pass the URL of your webpage to it
Pass the path and name of the image file (with extension) where the image will be saved
If required, any additional delay to ensure the chart is completely rendered.

Add Page Numbers to Paginated Data

I have implemented pagination to my data, but the problem is I only have the Next and Previous links, like so:
What I would like to do is add page numbers, with the page number I am on as normal text, and the other pages as links. So if I am on page 3 of 5, it would like look like this:
Here is what I have so far:
<cfset data = queryNew("id,name,age,active","integer,varchar,integer,bit")>
<cfloop index="x" from="1" to="50">
<cfset queryAddRow(data)>
<cfset querySetCell(data,"id",x)>
<cfset querySetCell(data,"name","User #x#")>
<cfset querySetCell(data,"age",randRange(20,90))>
<cfset querySetCell(data,"active",false)>
</cfloop>
<cfset perpage = 10>
<cfparam name="url.start" default="1">
<cfif not isNumeric(url.start) or url.start lt 1 or url.start gt data.recordCount or round(url.start) neq url.start>
<cfset url.start = 1>
</cfif>
<h2>Random People</h2>
<cfoutput query="data" startrow="#url.start#" maxrows="#perpage#">
#currentrow#) #name#<br />
</cfoutput>
<p align="right">
[
<cfif url.start gt 1>
<cfset link = cgi.script_name & "?start=" & (url.start - perpage)>
<cfoutput>Previous Page</cfoutput>
<cfelse>
Previous Page
</cfif>
/
<cfif (url.start + perpage - 1) lt data.recordCount>
<cfset link = cgi.script_name & "?start=" & (url.start + perpage)>
<cfoutput>Next Page</cfoutput>
<cfelse>
Next Page
</cfif>
]
</p>
There is a very good ColdFusion Open Source pagination project on RIAForge: http://paginationcfc.riaforge.org/. It covers everything you need and comes with a lot of predefined styles. At least you can analyze the code and customize it to meet your requirements.
This was a fun question. How about this to build your list of page links:
<cfset pageList = "">
<cfloop from="1" to="#ceiling(data.RecordCount/perpage)#" index="i">
<!--- Determine the start record for selected page --->
<cfset targetRecord = 1 + (perpage * (i - 1))>
<cfif ceiling(url.start/perpage) NEQ i>
<cfset link = cgi.script_name & "?start=" & targetRecord>
<cfset pageList = listAppend(pageList, "#i#", " ")>
<cfelse>
<cfset pageList = listAppend(pageList, i, " ")>
</cfif>
</cfloop>
Now you can just drop pageList into your navigation section like so:
<p align="right">
[
<cfif url.start gt 1>
<cfset link = cgi.script_name & "?start=" & (url.start - perpage)>
<cfoutput>Previous Page</cfoutput>
<cfelse>
Previous Page
</cfif>
/
#pageList#
/
<cfif (url.start + perpage - 1) lt data.recordCount>
<cfset link = cgi.script_name & "?start=" & (url.start + perpage)>
<cfoutput>Next Page</cfoutput>
<cfelse>
Next Page
</cfif>
]
</p>