Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
SincityViper #1
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 predefined.
This way the user will select which columns and what order they appear in.
This is a sample, there are actually 14 columns in the table.
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><select name="col_1">
<option value="">Skip</option>
<option value="stockno">Stockno</option>
<option value="price">Price</option>
<option value="cat">Cat</option>
</select></td>
<td><select name="col_2">
<option value="">Skip</option>
<option value="stockno">Stockno</option>
<option value="price">Price</option>
<option value="cat">Cat</option>
</select></td>
<td><select name="col_3">
<option value="">Skip</option>
<option value="stockno">Stockno</option>
<option value="price">Price</option>
<option value="cat">Cat</option>
</select></td>
<td><select name="col_4">
<option value="">Skip</option>
<option value="stockno">Stockno</option>
<option value="price">Price</option>
<option value="cat">Cat</option>
</select></td>
</tr>
</table>
Honesty I have not clue how to do this?
I have tried a few things, and nothing to seems to come close.
Any ideas.
Thanks
Johnny
SincityViper Guest
-
Arranging Query Columns
This is my query <cfset Totals = queryNew("TotalPointsEarned,EarnedPointsCost,TotalPointsRedeemed,RedeemedPointsC... -
Query of Queries Combinding Columns
I have two text files that I am using a cfhttp tag to query. I then need to combined the two queries to one query subtracting the "CHANGE" field... -
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... -
jdeline #2
Re: Specify Query Columns from From
You can simplify the job by placing your <OPTION> set in a loop. See code
below.
<CFLOOP INDEX="i" START="1" STOP="14">
<SELECT NAME="col_#i#">
<OPTION VALUE="">Skip
<OPTION VALUE="stockno">Stockno
<OPTION VALUE="price">Price
<OPTION VALUE="cat">CAT
</SELECT>
</CFLOOP>
jdeline Guest
-
SincityViper #3
Re: Specify Query Columns from From
How would this build the report page so that the columns are in the order they
select.?
I am trying to build a script where a user can select what columns in a
database table they want to display in a report.
In one they may want they columns to appear like this in report.
stockno,price,model
in another they may want it like this
model,price,cat,stockno,wholesale
Any Ideas
SincityViper Guest
-
jdeline #4
Re: Specify Query Columns from From
Refering to my earlier code, replace the "Skip" option line with this: <OPTION
VALUE="" SELECTED>Skip. Now, if you select the third select box and choose
"Price", you are assured to get the following passed to your results page:
col_1: skip
col_2: skip
col_3: price
col_4: skip
etc.
So your results page knows column 1 should be price. The following code might
help:
<CFLOOP INDEX="i" START="1" TO="14">
<CFIF Evaluate("col_#i#") IS NOT "skip">
<!--- do your thing here --->
</CFIF>
</CFLOOP>
jdeline Guest
-
SincityViper #5
Re: Specify Query Columns from From
jdeline,
I got that part, the part I am looking is the results page. Right now, if I
pass form vars as the query columns, cfoutput or cfloop will not return the
query over easily. I say easily because I can not figure it out.
Any ideas on the results page.
Johnny
SincityViper Guest



Reply With Quote

