I have a form where the user selects what department data they want to look at by checking off the areas they are interested in. The checkbox data is passed to the query as a list which is where I'm running into problems. Each department has its own set of data that will be output to a table on the results page. Right now the output is coming out with the whole department as a list and only one of the department's data showing up. How do I get each individual department's name and it corresponding data set to come out so it can be displayed?
Example:
<cffunction access="public" name="getInformation">
<!--- checks to see that there is a value for the department list --->
<cfif isDefined("form.department") is "True">
<cfquery name="getInfo" dataSource="departmentdata">
SELECT *
FROM DepartmentSet
WHERE department IN (<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.department#" list="yes" separator=",">) AND location = 'Gettysburg'
ORDER BY department ASC
</cfquery>
<cfelse>
<cfquery name="getInfo" dataSource="departmentdata">
SELECT *
FROM DepartmentSet
WHERE department = 'none'
</cfquery>
</cfif>
<cfreturn getInfo>
</cffunction>
Example:
<cffunction access="public" name="getInformation">
<!--- checks to see that there is a value for the department list --->
<cfif isDefined("form.department") is "True">
<cfquery name="getInfo" dataSource="departmentdata">
SELECT *
FROM DepartmentSet
WHERE department IN (<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#form.department#" list="yes" separator=",">) AND location = 'Gettysburg'
ORDER BY department ASC
</cfquery>
<cfelse>
<cfquery name="getInfo" dataSource="departmentdata">
SELECT *
FROM DepartmentSet
WHERE department = 'none'
</cfquery>
</cfif>
<cfreturn getInfo>
</cffunction>