Combining two lists of values so I can loop through them as one list
Posted on 2003-03-26
I have created a form that displays a record set using the cfgrid component. Right now, users are able to filter the list based on a single condition. For example, they can see all items with a 'Developer' value of 'Bob'. The values for Filterby (Developer) and Filtervalue (Bob) are being sent as URL variables. However, now I'm trying to allow the filter to have multiple conditions. For example, Developer='Bob' AND 'open_closed=Open'. Hence, the value for Filterby would be 'Developer, open_closed' and the value for Filtervalue would be 'Bob, Open'. How can I combine these two lists into one structure so that I can loop through the values and set each condition in a query that I'm building on the fly based on the url variables? Thanks in advance for your help...I'll copy the pertinent code below:
This is the URL with the variables:
This is the query I'm trying to build:
<CFQUERY DBTYPE="query" name="TrackerList" cachedwithin="#CreateTimeSpan(0,0,0,-1)#">
FROM <cfif NOT IsDefined("history")>TrackerCache<cfelse>TrackerHistory</cfif>
<CFIF (ParameterExists(Filterby) IS "Yes")>
<cfif (Filterby IS NOT 'blank') AND (Filterby IS NOT 'Title') AND (Filterby IS NOT 'Manager') AND (Filterby IS NOT 'QA') AND (Filtervalue IS NOT 'isnull')>
AND #Filterby# = '#filtervalue#'
<cfelseif Filtervalue IS 'isnull'>
AND (#Filterby# IS NULL)
<cfelseif Filterby IS 'Title'>
AND #Filterby# LIKE '%#filtervalue#%'
<cfelseif Filterby IS 'QA'>
AND Status = 'Ready for Review' AND Reviewer = '#session.userid#'
<cfelseif (Filterby IS 'manager') AND (session.roleID Contains 'DevManager')>
AND Status = 'New' AND Product IN (#PreserveSingleQuotes(prodsmanaged)#)
ORDER BY ItemNumber