Ask a Question related to Coldfusion Database Access, Design and Development.
-
Maneesh Tikkiwal #1
Arranging Query Columns
This is my query
<cfset Totals =
queryNew("TotalPointsEarned,EarnedPointsCost,Total PointsRedeemed,RedeemedPointsC
ost,PointsreedemedHandling,RedemedTotal,TotalPoint sUnRedeemed,UnRedeemedPointsCo
st,PointsUnreedemedHandling,UnRedemedTotal")>
<cfset queryAddRow(Totals)>
<cfset querySetCell(Totals, "TotalPointsEarned",
"#DecimalFormat(TotalPointsEarned)#")>
<cfset querySetCell(Totals, "EarnedPointsCost",
"#DecimalFormat(EarnedPointsEarned)#")>
<cfset querySetCell(Totals, "TotalPointsRedeemed",
"#DecimalFormat(ALLTotalPoints)#")>
<cfset querySetCell(Totals, "RedeemedPointsCost",
"#DecimalFormat(ALLPoints_Cost)#")>
<cfset querySetCell(Totals, "PointsreedemedHandling",
"#DecimalFormat(Handling)#")>
<cfset querySetCell(Totals, "RedemedTotal", "#DecimalFormat(Total)#")>
<cfset querySetCell(Totals, "TotalPointsUnRedeemed",
"#DecimalFormat(ALLTotalUnredeemed)#")>
<cfset querySetCell(Totals, "UnRedeemedPointsCost",
"#DecimalFormat(ALLUnredeemed_points)#")>
<cfset querySetCell(Totals, "PointsUnreedemedHandling",
"#DecimalFormat(Unred_Handling)#")>
<cfset querySetCell(Totals, "UnRedemedTotal",
"#DecimalFormat(TotalHandling)#")>
<cfdump var="#totals#"><cfabort>
The problem is, if I dump it, the query doen't put the cells in the same order
as I have created them. It autoArranges it to Alphabetical Order. Can anyone
Help please?
This is the sequence I want.
TOTALPOINTSEARNED
EARNEDPOINTSCOST
TOTALPOINTSREDEEMED
REDEEMEDPOINTSCOST
POINTSREEDEMEDHANDLING
REDEMEDTOTAL
TOTALPOINTSUNREDEEMED
UNREDEEMEDPOINTSCOST
POINTSUNREEDEMEDHANDLING
UNREDEMEDTOTAL
But, this is the sequence I get.
EARNEDPOINTSCOST
POINTSREEDEMEDHANDLING
POINTSUNREEDEMEDHANDLING
REDEEMEDPOINTSCOST
REDEMEDTOTAL
TOTALPOINTSEARNED
TOTALPOINTSREDEEMED
TOTALPOINTSUNREDEEMED
UNREDEEMEDPOINTSCOST
UNREDEMEDTOTAL
Any help will be much appriciated.
Cheers.
Maneesh Tikkiwal Guest
-
How to get the number of retrieved columns when doing a SQL Query
Hello everyone, i just implement an own search site in MS CRM 1.2, which searches in a MS-SQL database. My question is, how to get the number... -
Specify Query Columns from From
I want to create a form where a user can select from a drop down box which query colums they want to select and in what order. The form will be... -
displaying query in 2 columns
Hi Guys, need your help on this please, I am trying to get the result of my query splited in 2 columns, where in the first column will have my first... -
How to span a query into 2 columns
I have a query that produces a list of products and some of those products are subdivided into groups within the list. I have a query that... -
query results in 2 columns?
I'm struggling to figure out how to do this properly. I have done a mySQL query to extract a list of names, and done a mysql_num_rows to determine... -
paross1 #2
Re: Arranging Query Columns
Why are you using CFDUMP to display our output? This tag is intended as a tool
that Outputs variables for debugging purposes. Using cfdump, you can display
the contents of simple variables, queries, arrays, structures, and WDDX
variables created with cfwddx.
Phil
paross1 Guest
-
Maneesh Tikkiwal #3
Re: Arranging Query Columns
cfdump is just for testing. don't worry about that. if you know the answer to my query please do let me know.
Maneesh Tikkiwal Guest
-
paross1 #4
Re: Arranging Query Columns
The answer is, if you use CDFUMP, you are stuck with the column names being
sorted alphabetically. That is why I was implying as to why you would care
about the sort order ,unless you actually planned on using CFDUMP for anything
other than for testing and debugging. So, if you want to control the order of
the columns, don't use CFDUMP.
Phil
paross1 Guest
-
Maneesh Tikkiwal #5
Re: Arranging Query Columns
Hello Phill/ everyone.
I do not intend to use cfdump for other then testing purposes. I am using this
code to export the resul to excel using the custom tag QueryToExcel, I am
passing the values as below
<cfset Totals =
queryNew("TotalPointsEarned,EarnedPointsCost,Total PointsRedeemed,RedeemedPointsC
ost,PointsreedemedHandling,RedemedTotal,TotalPoint sUnRedeemed,UnRedeemedPointsCo
st,PointsUnreedemedHandling,UnRedemedTotal")>
<cfset queryAddRow(Totals)>
<cfset querySetCell(Totals, "TotalPointsEarned",
"#DecimalFormat(TotalPointsEarned)#")>
<cfset querySetCell(Totals, "EarnedPointsCost",
"#DecimalFormat(EarnedPointsEarned)#")>
<cfset querySetCell(Totals, "TotalPointsRedeemed",
"#DecimalFormat(ALLTotalPoints)#")>
<cfset querySetCell(Totals, "RedeemedPointsCost",
"#DecimalFormat(ALLPoints_Cost)#")>
<cfset querySetCell(Totals, "PointsreedemedHandling",
"#DecimalFormat(Handling)#")>
<cfset querySetCell(Totals, "RedemedTotal", "#DecimalFormat(Total)#")>
<cfset querySetCell(Totals, "TotalPointsUnRedeemed",
"#DecimalFormat(ALLTotalUnredeemed)#")>
<cfset querySetCell(Totals, "UnRedeemedPointsCost",
"#DecimalFormat(ALLUnredeemed_points)#")>
<cfset querySetCell(Totals, "PointsUnreedemedHandling",
"#DecimalFormat(Unred_Handling)#")>
<cfset querySetCell(Totals, "UnRedemedTotal",
"#DecimalFormat(TotalHandling)#")>
The problem is, on the excel sheet, its not coming as I have defined them. The
column names are sorted in alphabetical order and are not displayed in the
sequence as I create them.
Any help will be much appriciated.
Regards
Maneesh Tikkiwal Guest
-
Adam Cameron #6
Re: Arranging Query Columns
> I do not intend to use cfdump for other then testing purposes. I am using this
Does this QueryToExcel custom tag (I can find no reference to this custom> code to export the resul to excel using the custom tag QueryToExcel, I am
> passing the values as below
tag on google) not permit you to specify which order to process the
columns?
You're kind of at the mercy of how QueryToExcel has been coded...
--
Adam
Adam Cameron Guest
-
jdeline #7
Re: Arranging Query Columns
Have you looked at CFX_Exce at [url]http://www.cftagstore.com/tags/cfxexcel.cfm?[/url] Maybe that will suit your purpose.
jdeline Guest



Reply With Quote

