Avatar of Eric Bourland
Eric Bourland
Flag for United States of America asked on

Grouping question

ColdFusion 9
MS SQL Server 2005

Hi. My CFOUTPUT does not group on column PublicationYear the way that I think it should. =) How can I edit my query or my output to get this result:

"CEP scheduled no meetings in year 2011."

rather than this result:

"CEP scheduled no meetings in year 20112011201120112011201120112011201120112011201120112011201120112011."

I am guessing I cannot group variable #url.selectedYear# on column PublicationYear because variable #url.selectedYear# is not referenced in query getDocumentYears.

Thanks as always for advice. I've been puzzling over this task for a while today.

Eric

Query, getDocumentYears:

<!--- query to select document publication years --->
<cfquery name="getDocumentYears" datasource="#application.datasource#">
SELECT DISTINCT Year(DocumentPublicationDate) AS PublicationYear
FROM tbl_CEP_Documents
ORDER BY PublicationYear DESC
</cfquery>

Output:

<p>CEP scheduled no meetings in year <cfoutput query="getDocumentYears" group="PublicationYear" groupcasesensitive="no">#url.selectedYear#</cfoutput>.</p>

Example: http://www.cep-dc.org/meetings/index.cfm?selectedYear=2011

Open in new window

ColdFusion Language

Avatar of undefined
Last Comment
Eric Bourland

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
_agx_

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Eric Bourland

ASKER
That was it. I was wondering if it might be the other query. This worked:

<cfif ...>
...

<cfelseif getDocumentsandFiles.recordCount eq 0>

<p>CEP scheduled no meetings in year <cfoutput>#url.selectedYear#</cfoutput>.</p>

</cfif>
Eric Bourland

ASKER
Thank you as always, _agx_. Hope you are well.

Eric
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy