Ask a Question related to Coldfusion - Getting Started, Design and Development.
-
simprini #1
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 half
and the second column will have the other half, can you guys help? I need that
in orther the first column the first amount of data and the second the rest of
the data, really apreciated that. Thank you Titano Cruz
simprini Guest
-
displaying multiple columns in <cfselect>
ok, I have a database that house a table called model. The model contains a manufacturer foreign key and 3 other fileds for that table. I want... -
Hiding/Displaying... Columns....
How to hide/display the datagrid colums at run time? ..Net 1.1. Thanks, Smith -
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 images in multiple columns
hi, i want to display in my form pictures(the url is taken from a database), like this: pic1 pic2 pic3 pic4 pic5 pic6 .... i ve... -
Displaying fields(columns) in MS Access
Good day to everyone. I have found using various connection types my table display comes up differently. If I use an OLEDB type connections my... -
simprini #2
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 half
and the second column will have the other half, can you guys help? I need that
in orther the first column the first amount of data and the second the rest of
the data, really apreciated that. Thank you Titano Cruz
simprini Guest
-
simprini #3
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 half
and the second column will have the other half, can you guys help? I need that
in orther the first column the first amount of data and the second the rest of
the data, really apreciated that. Thank you Titano Cruz
simprini Guest
-
zoeski80 #4
Re: displaying query in 2 columns
Hi Titano
Here is one way, have a table and loop through the first half of the query for
the first column of the table and the 2nd half of the query for the second
table column.
Can probably make the code a bit better but thats the idea.
HTH
Zoe
<CFSET halfWay = ceiling(queryName.RecordCount / 2) - 1>
<TABLE>
<TR><TD>
<CFLOOP QUERY="queryName" STARTROW="1" ENDROW="#halfWay#">
#output#<BR>
</CFLOOP>
</TD>
<TD>
<CFLOOP QUERY="queryName" STARTROW="#halfWay#"
ENRROW="#queryName.RecordCount#">
#output#<BR>
</CFLOOP>
</TD></TR>
</TABLE>
zoeski80 Guest
-
Paul Whitham TMM #5
Re: displaying query in 2 columns
I do not believe that you can loop content from one column to another like
on a printed page however you could achieve it will a little scripting and
assuming that your layout is CSS based. This is what I would do
1) Work out the number of line in the query and set it to a value
<cfset TotalLine = QueryName.RecountCount>
2) Then find the middle
<cfset HalfWay = TotalLine/2>
3) Now write the first column
<div id="leftcol">
<cfoutput query="QueryName">
<CFIF QueryName.CurrentRow LE HalfWay>
#Fieldname#
</cfif>
</cfoutput>
</div>
4) Finally write the second column
<div id="rightcol">
<cfoutput query="QueryName">
<CFIF QueryName.CurrentRow GT HalfWay>
#Fieldname#
</cfif>
</cfoutput>
</div>
--
Regards
Paul Whitham
Macromedia Certified Professional for Dreamweaver MX2004
Valleybiz Internet Design
[url]www.valleybiz.net[/url]
Team Macromedia Volunteer for Ultradev/Dreamweaver MX
[url]www.macromedia.com/support/forums/team_macromedia[/url]
"simprini" <webforumsuser@macromedia.com> wrote in message
news:d0l7d0$klm$1@forums.macromedia.com...my> Hi Guys, need your help on this please, I am trying to get the result ofhalf> query splited in 2 columns, where in the first column will have my firstthat> and the second column will have the other half, can you guys help? I needrest of> in orther the first column the first amount of data and the second the> the data, really apreciated that. Thank you Titano Cruz
>
Paul Whitham TMM Guest
-
externalError #6
Re: displaying query in 2 columns
I think this is what you need:
<cfquery datasource="#DSN#" name="Q">
<!--- Your SQL statement goes here --->
</cfquery>
<cfset recordcountHalf = Q.recordcount \ 2>
<table>
<tr>
<td>
<cfoutput query="Q" startrow="1" maxrows="#variables.recordcountHalf#">
<!--- Display data --->
</cfoutput>
</td>
<td>
<cfoutput query="Q" startrow="#val(variables.recordcountHalf+1)#">
<!--- Display data --->
</cfoutput>
</td>
</tr>
</table>
externalError Guest
-
pdlnhrd #7
Re: displaying query in 2 columns
here is a little more complex example. it will allow you to display it in a
table. just replace query with your query name and columnname with the column.
<cfset foo = Int(query.recordcount / 2) + query.recordcount mod 2 /> <table>
<cfloop from='1' to='#foo#' index='x'> <tr>
<td>#query['columnname'][x]#</td> <cfif foo + x lte query.recordcount>
<td>#query['columnname'][foo+x]#</td> <cfelse> <td>&nbsp;</td>
</cfif> </tr> </cfloop> </table> hope that helps
pdlnhrd Guest



Reply With Quote

