Well, lets draw out your lists, and the problem is obvious.

You search in list2 with a delimeter of ";", so your list looks like...


1
yes,2
no,3
maybe

If you want more, just ask...

Jerry Johnson

>>> [EMAIL PROTECTED] 12/07/01 03:10PM >>>
I have two lists that I need to compare. List one is a comma delimited
list pulled from a record in the database (1,2,3) List two is comma
delimited but has two values separated by a semi-colon that is an
application variable (1;yes,2;no,3;maybe). The problem I am having is
that I want to compare list1 with the first value in list2, if list1
matches list2 I would like to display the second value of list2.
 
This is the code that I have written:
 
<cfloop list="#list1#" index="i">
<cfif listfind(list2,i,";")>
<cfset theposition=listfind(list2,i,";")>
<cfset element=listgetat(list2,theposition,",")>
<cfset description= listgetat(element,  "2" , ";")>
<cfset description1= listlast(description, ",")>
</cfif>
</cfloop>
 
This code finds the first element in list1 and list2 and displays the
second value in list2 properly and that is all. It is not displaying any
of the other values because it cannot find them, even though  they are
in list1 and the first value in list2.
 
If anyone can help me out with this I would really appreciate it.
 
Thanks
 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to