I am trying to populate a list (EmployeeList) with a custom query, in order to include grandparent info (company). The
query works fine, but I am trying to get it to honor embedded search form fields which will change the EmployeeCriteria
session variable. I am trying to trap that and use it at the tail end of the where clause, with no success. For some
reason the search criteria is not changing. If I revert back to the default query, it runs fine. Any idea how I can do
this?
<cfscript>
// Select query parameters
selectClause = "Employee.EmployeeID AS Employee_EmployeeID, Employee.OfficeID AS Employee_OfficeID, Company.CompanyID AS
Company_CompanyID, Company.CompanyName AS Company_CompanyName, Office.OfficeID AS Office_OfficeID, Office.OfficeName AS
Office_OfficeName, Employee.LastName AS Employee_LastName, Employee.FirstName AS Employee_FirstName, Employee.MiddleName
AS Employee_MiddleName, Employee.Title AS Employee_Title, Employee.Email AS Employee_Email";
fromClause = "Company, Office, Employee";
whereClause = "Company.CompanyID = Office.CompanyID AND Employee.OfficeID =
Office.OfficeID AND #Session.employeecriteria#";
if(URL.sortOrder EQ 1)
orderByClause = "Employee.LastName ASC, Employee.FirstName ASC";
else
orderByClause = "Employee.Email ASC";
getEmployees = Application.DatabaseBlocks.SelectRecords(selectClause:selectClause, fromClause:fromClause,
whereClause:whereClause, orderByClause: orderByClause);
</cfscript>
Jeff
**********************************************************************
You can subscribe to and unsubscribe from lists, and you can change
your subscriptions between normal and digest modes here:
http://www.productivityenhancement.com/support/DiscussionListsForm.cfm
**********************************************************************