Hi all,
I have a stored procedure which is returning a specific set of data related to a customer. The data is being displayed in coldfusion so that information is returned for each customer.
Eg.
Heading 1 Heading 2 Heading 3
Mary Smith
1 2 3
Heading 1 Heading 2 Heading 3
Nancy Turner
1 2 3
Heading 1 Heading 2 Heading 3
Gary Silly
1 2 3
The way I have this is by calling the procedure:
<cfstoredproc datasource="#Request.MyDSN
#" procedure="[sp_retrieve_da
ta">
<cfprocparam cfsqltype="CF_SQL_TIMESTAM
P" value="#form.Issued_Date#"
/>
<cfprocparam cfsqltype="CF_SQL_VARCHAR"
value="#form.state#" />
<cfprocparam cfsqltype="CF_SQL_VARCHAR"
value="#form.selectRegion#
" />
<cfprocresult name="MyQuery" resultset="1" />
</cfstoredproc>
I then query to pull back each customer:
<cfquery name="qCust" dbtype="Query">
select distinct cust
from MyQuery
order by cust
</cfquery>
Then, I have another query:
<cfloop query="qCustp">
<cfquery name="qDetail" dbtype="query">
select data1, data2, data3
from MyQuery
where
cust = '#qCust.cust#'
</cfquery>
Then with a table, I output the headings and the data from qDetail.
I would now like to show 2 sections for each customer one which is already there, and if there are any previous orders,
I would like that to show beneath it, so for example:
Customer Data
Heading 1 Heading 2 Heading 3
Mary Smith
1 2 3
Previous Orders
Heading 1 Heading 2 Heading 3
Mary Smith
1 2 3
Customer Data
Heading 1 Heading 2 Heading 3
Nancy Turner
1 2 3
Previous Orders
Heading 1 Heading 2 Heading 3
Nancy Turner
1 2 3
Right now, I have all that I need being returned from the procedure. I think I need to somehow add another loop in the coldfusion page. This is where I need help. Any insight would be most appreciated. Thanks.
Start Free Trial