Hi there,
I'm replicating the look of an Access form in Coldfusion
In Access I can create group headers to sort my data, so all the jobs under a particular site appear under that site name - which appears only once.
I'm using a cfloop query to get all my results in CF so my site name is repeated constantly. - like so
Site: MYSITE1
Job1
Site:MYSITE1
Job2
How do I get it to appear only once, as a header for all the jobs underneath it? Obviously the loop will need to go on and output the jobs under the next site, with that only having one header as well. like so...
Site: MYSITE1
Job1
Job2
Job3
Site: MYSITE2
Job1
Job2
Thanks for your help!
You can also use cfoutput's group attribute. Just order your results by "Site" first. Then use nested cfoutput tags and group by "Site" as well. -
<cfquery ..>
-
SELECT Site, Job, ... other columns
-
FROM Thetable
-
ORDER BY Site, Job, ... other columns
-
</cfquery>
-
-
<cfoutput query="yourQuery" group="Site">
-
#Site#<br>
-
<cfoutput>
-
#Job#<br>
-
</cfoutput>
-
</cfoutput>
-
6 4326
Can you post the cfloop code.
Hi Acoder,
I certainly can: -
<tr>
-
<cfloop query="ManagerJobsIn">
-
<cfoutput>
-
<tr>
-
<td colspan="14" style="color: red; font-weight: 600;">#ClientFK#</td>
-
</td>
-
-
<tr>
-
<td colspan="14" style="color: red; font-weight: 600;">#SiteFK#</td>
-
</td>
-
-
<tr bgcolor="###iif(currentrow MOD 2,DE('ffffff'),DE('efefef'))#">
-
<td width="20%">#AssetClassFK#</td>
-
<td>#ManufacturerFK#</td>
-
<td>#ModelFK#</td>
-
<td>#PowerRating#</td>
-
<td>#ClientWONO#</td>
-
<td>#WorkshopWONO#</td>
-
<td>#dateFormat(WoRecdate,'dd/mm/yyyy')#</td>
-
<td>#dateFormat(QuotePDate,'dd/mm/yyyy')#</td>
-
<td>#numberFormat(Price, "(______,.00")#</td>
-
<td>#dateFormat(QuoteACDate, 'dd/mm/yyyy')#</td>
-
<td>#ResponseLevelFK#</td>
-
<td>#dateFormat(ActualCompDate, 'dd/mm/yyyy')#</td>
-
<td>#AssignedToFK#</td>
-
</tr>
-
-
-
</cfoutput>
-
</cfloop>
-
</table>
-
-
Cheers
Neil
Assuming the sites are sorted and grouped in the query, e.g. - Site Job
-
1 1
-
1 2
-
1 3
-
2 1
-
2 2
you can use a variable to store the current site, e.g. MYSITE1. Then compare with the SiteFK value. If it's equal, don't add a header. If it's a new site, add a header and set that variable to this new value.
Acoder,
That's great - I'll give it a go.
Cheers
Neil
You can also use cfoutput's group attribute. Just order your results by "Site" first. Then use nested cfoutput tags and group by "Site" as well. -
<cfquery ..>
-
SELECT Site, Job, ... other columns
-
FROM Thetable
-
ORDER BY Site, Job, ... other columns
-
</cfquery>
-
-
<cfoutput query="yourQuery" group="Site">
-
#Site#<br>
-
<cfoutput>
-
#Job#<br>
-
</cfoutput>
-
</cfoutput>
-
Nice tip. Thanks for sharing!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Curt Bousquet |
last post by:
Hi;
I'm brand new to PHP (just starting today to convert tons of
ColdFusion/Access code to PHP/MySQL). There is a function in
Coldfusion that I can't find an equivalent to in PHP. Here is
what...
|
by: MLH |
last post by:
I have a challenge...
In a table I call tblStuff4Letters with 3 fields:
, and . I have
a report called rptOutboundCorrespondence that feeds
off this table. Sorting & grouping is turned on in...
|
by: ahaque38 |
last post by:
Hello.
Using A2K SP3, I am having the following problem with a report using
"Sorting and Grouping".
I have recently added a grouping in the reports for
"Category2<>'CONTRACTS'".
I have...
|
by: Mike MacSween |
last post by:
tblCourses one to many to tblEvents.
A course may have an intro workshop (a type of event), a mid course
workshop, a final exam. Or any combination. Or something different in the
future.
At...
|
by: Daniel Vallstrom |
last post by:
I'm having problems with inconsistent floating point behavior
resulting in e.g.
assert( x > 0.0 && putchar('\n') && x == 0.0 );
holding. (Actually, my problem is the dual one where I get...
|
by: Jimmy |
last post by:
Is there a way to sort/group a report based on the second column of a combo
box, i.e. the text associated with the primary key number?
|
by: wingnut144 |
last post by:
I have the following XML file:
<?xml version="1.0" encoding="utf-8"?>
<class>
<sdate>9/10/07</sdate>
<special>1,2</special>
<inst>Max Callao</inst>
<sdate>10/22/07</sdate>...
|
by: jjjoic |
last post by:
Hi,
I use Access 2003 to generate the back-end data for a ColdFusion report at work. The report is sorted by a column and based on the sorting, rankings are assigned to each row(i.e. the biggest...
|
by: kstevens |
last post by:
I have a report, and on the report is a min, avg, and max query each with (ok who really cares) 20 or so records. At the footer of the report i would like to have a total. I requery for each...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
| |