Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List Function Confusion

Status
Not open for further replies.

szeiss

Programmer
Apr 5, 2000
137
US
I'm using CF8.

I have the following partial query -
Code:
<cfquery dbtype="query" name="getVendor">
  select distinct
     vendor,
     loc_code
  from
     variables.savedlist
</cfquery>

I'm using this query in a cfdocument pdf type report. I need to loop thru this query and look for where the loc_code is equal to either LO, AU or SL, because those will be grouped together under a particular subheading; whereas the rest will go under another subheading. I'm confused as to what function to use ListFindNoCase, ListContains, ListFind...etc. They look so much alike.

Thanks,
Sherry
 
It is not clear why you need to use list functions.

Typically if you wanted to group several values under one heading, you would use a CASE statement within your original database query. ie

Code:
SELECT vendor
       , loc_code
       , CASE 
              WHEN loc_code IN ('LO','AU','S') THEN 'return heading A'
              ELSE 'some other header' 
         END AS HeadingValue
FROM   YourTable
ORDER BY HeadingValue, Vendor

----------------------------------
 
and if you wanted to group several values under one heading, you'd use the GROUP= option of the CFOUTPUT tag (as well as ORDER BY in your query-of-query)

and i'm not sure why your query-of-query is trying to read a variable instead of a previously executed query

r937.com | rudy.ca
Buy my new book Simply SQL from Amazon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top