I am trying to find strings inside lists of other stings. What I have is two tables the first is Sessions with a column LocationID which is a comma delimited list of UUID's the second table is Location with the primary key LocationID. I am trying to create a new table from the old so that instead of Sessions.LocationID being a list of locations that it will have a record for each one, but at the same time if a session isn't being held at a certain locatain that a record will be created with a flag set to false. Here is the code that I have so far :
right now I know that it is looping correctly through everythings because I get the correct number of lines, but everything comes out false. Does any of this make sense?
Code:
<!---query for locations of a certain group (will eventually loop over all groups) --->
<cfquery name="qLocation">
select LocationID from Locations where GroupID='1'
</cfquery>
<!--- convert query to list --->
<cfparam name="listLocation" default="">
<cfloop query="qLocation">
<cfset listLocation=listappend(listLocation,qLocation.LocationID)>
</cfloop>
<cfset qualifiedlistLocation=listqualify(listLocation,"'")>
<!--- query all sessions --->
<cfquery name="qSessions">
select LocationID from Sessions
</cfquery>
<!--- loop over all sessions and find locations that are in session records ---->
<cfloop query="qSessions">
<cfloop index="locID" list="#qSessions.LocationID#" delimiters=",">
<cfif ListFind(qualifiedlistLocation,qSessions.LocationID,",")>
true
<!--- create record and set location flag to true --->
<cfelse>
false
<!--- create record and set locatin flag to false --->
</cfif>
</cfloop><br>
</cfloop>
right now I know that it is looping correctly through everythings because I get the correct number of lines, but everything comes out false. Does any of this make sense?