Try to use the List functions, or extend the CFIf to be;
cfif ",#deptID#," contains ",#session.priviliges#,"
which is faster than the List functions
This would only work if the item were not the first or last
element in the
list.
Either you would have to use a reg expression
Yeah well this one win, dread.
This man went and did Time Trials on the loop
=)
Now I'm totally confused as to which method to use..
A CFLOOP with a CFIF Contains...
Or one with a NOT GetListAt.
(bear in mind that for htis particular problem, #DeptID# is a list of
values,not necessarily a
Use ListFind, which looks for a complete value:
cfif listfind( mylist, myvalue )
David
-Original Message-
From: Angel Stewart [mailto:[EMAIL PROTECTED]]
Sent: Saturday, July 15, 2000 6:52 AM
To: [EMAIL PROTECTED]
Subject: Re: Variable IN a list? How to check?
Yeah well this one
cfif #deptid# contains #session.privileges#
Avoid using this on lists
The main reason is that if you're looking for "1", then it'll return 10, 11,
21, etc. etc.
Try to use the List functions, or extend the CFIf to be;
cfif ",#deptID#," contains ",#session.priviliges#,"
which is faster than
Try to use the List functions, or extend the CFIf to be;
cfif ",#deptID#," contains ",#session.priviliges#,"
which is faster than the List functions
This would only work if the item were not the first or last element in the
list.
Either you would have to use a reg expression or
CFIF ListFind(Deptid,session.privileges)
Chris Evans
[EMAIL PROTECTED]
http://www.fuseware.com
-Original Message-
From: Angél Stewart [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 13, 2000 12:39 PM
To: [EMAIL PROTECTED]
Subject: Variable IN a list? How to check?
How would i write
I wrote a little tag to do a "list_xand"; it returns the list of items that
are in both of two different lists. You could modify it, or use it as-is
and then do a listlen() to make sure that you didn't lose any privileges.
cfsetting enablecfoutputonly="yes"
!--- list_xand.cfm
cfif #deptid# contains #session.privileges#
Lee Fuller
Chief Technical Officer
PrimeDNA Corporation
-Original Message-
From: Angél Stewart [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 13, 2000 9:39 AM
To: [EMAIL PROTECTED]
Subject: Variable IN a list? How to check?
How
Instead of:
Cfif #Deptid# IN #session.privileges#
Try something like this:
cfif listcontains(session.privileges, deptid) is not 0
(Not sure on the exact syntax. This is direct from the CFML 4.0 language
reference, and they don't use any ##'s or ""'s (i.e.
#listcontains(session.privileges,
Oh..thank you very much..but I figured it out.
I used a CFLOOP to cycle through the session.privileges list and then a
CFIF with a GetListAt(umm..SessionPrivileges,Counter) or something like
that.
I have the code in the office, I'll post the solution I managed tomorrow.
But it works like a
IN a list? How to check?
cfif #deptid# contains #session.privileges#
Lee Fuller
Chief Technical Officer
PrimeDNA Corporation
-Original Message-
From: Angél Stewart [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 13, 2000 9:39 AM
To: [EMAIL PROTECTED]
Subject: Variable
I was waiting for someone to come in with a good arrays or structures
solution (because we use lists way too much and I want to learn more - more
- more!) . . . but since we are stuck with lists lets answer the question
you really asked. :) You want to know if ALL of the values in Deptid are in
12 matches
Mail list logo