nmarano
asked on
creating a new list
Experts-
I am trying to create a new list and am looking for some help.
<cfset mycorrectList = '1,2,3,4,5,6,7,8,9,10'>
<cfset mystudentList = '1,2,3,4,10'>
<cfif listfind(mystudentList,myc orrectList )>
.....Here I want to be able to delete the element if it is found and create a new list that would look like this..
<cfset mynewestList = '5,6,7,8,9'>
Can I use listDeleteAt? Not knowing where the element is located in my list doesn't allow me to use this does it? Any help would be appreciated
Thanks
Nick
I am trying to create a new list and am looking for some help.
<cfset mycorrectList = '1,2,3,4,5,6,7,8,9,10'>
<cfset mystudentList = '1,2,3,4,10'>
<cfif listfind(mystudentList,myc
.....Here I want to be able to delete the element if it is found and create a new list that would look like this..
<cfset mynewestList = '5,6,7,8,9'>
Can I use listDeleteAt? Not knowing where the element is located in my list doesn't allow me to use this does it? Any help would be appreciated
Thanks
Nick
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thanks! I had it set similar except I was missing the eq 0
<cfloop index="i" list="#myCorrectList#">
<cfif listFind(myStudentList, i)><!--- was missing eq 0 here --->
<cfset newList = listAppend(newList, i)>
</cfif>
</cfloop>
<cfloop index="i" list="#myCorrectList#">
<cfif listFind(myStudentList, i)><!--- was missing eq 0 here --->
<cfset newList = listAppend(newList, i)>
</cfif>
</cfloop>
ASKER