RE: contained in a list
let's say.. mynumber = 2 ans mylist = 2,67,34,52 cfIf listFind(myList,'2') = 0 ... You were very, very close. :) cfIf listFind(myList,'2') IS 0 You were very, very close as well :D Philip Arnold ASP Multimedia Limited T: +44 (0)20 8680 1133 "Websites for the real world" ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. ** -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: contained in a list
Correct me if I'm wrong here people, but I believe that if the list contains actual numbers (like from a numeric data field) then this list function will work correctly, but if it's a text string it won't. It's been a while since I checked on this. ListContains looks to see if any entries in the list CONTAINS the item you're looking for Therefore; ListContains("1,2,4,5,13,18,23,30","3") will product a number, ListFind("1,2,4,5,13,18,23,30","3") won't. CF doesn't treat numbers different from string when you're running a non-numeric function on them. Philip Arnold ASP Multimedia Limited T: +44 (0)20 8680 1133 "Websites for the real world" ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. ** -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
contained in a list
I need know if a number is one of a list item. let me explain let's say.. mynumber = 2 ans mylist = 2,67,34,52 I thought this would do .. cfif #listcontains(mylist, mynumber)# is 0 ... cfelse ... /cfif but it does not act like I want ... It compare the same whay as of strings and will find 2 and 52 What I want to do is to get the exact item in the list Someone has an idea on how to do it? Thanks -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: contained in a list
cfif listfindnocase('#mylist#','#mynumber#',',') NEQ 0 Not in list /cfif -Original Message- From: Gilles Ratte [mailto:[EMAIL PROTECTED]] Sent: Friday, July 07, 2000 10:52 AM To: 'cftalk' Subject: contained in a list I need know if a number is one of a list item. let me explain let's say.. mynumber = 2 ans mylist = 2,67,34,52 I thought this would do .. cfif #listcontains(mylist, mynumber)# is 0 ... cfelse ... /cfif but it does not act like I want ... It compare the same whay as of strings and will find 2 and 52 What I want to do is to get the exact item in the list Someone has an idea on how to do it? Thanks -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: contained in a list
Try ListFind At 10:51 AM -0400 7/7/2000, Gilles Ratte wrote: I need know if a number is one of a list item. let me explain let's say.. mynumber = 2 ans mylist = 2,67,34,52 I thought this would do .. cfif #listcontains(mylist, mynumber)# is 0 .. cfelse .. /cfif but it does not act like I want ... It compare the same whay as of strings and will find 2 and 52 What I want to do is to get the exact item in the list Someone has an idea on how to do it? Thanks -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_tal k or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: contained in a list
let's say.. mynumber = 2 ans mylist = 2,67,34,52 cfIf listFind(myList,'2') = 0 ... You were very, very close. :) Brandon Whitaker [EMAIL PROTECTED] --- "It'll get used by the same people using Opera. People dressed in black wearing berets." - Dave Watts, on Mozilla "It makes you feel so welcome to have a greeter like Papa Dave at the door. Kind of like what Wal-Mart wishes it could do." - John Allred, on Dave Watts "The net interprets censorship as damage and routes around it." - John Gilmore -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: contained in a list
If I understand you - you would like to see if a value is in a list - right ? cfset myNbrToFind = "2" cfset myListToSearch = "2,3,4,5,6,52" cfif ListFind(myListToSearch,myNbrToFind, ",") !--- do something cool if I find it ... and return the element position--- cfelse !--- do nothing because it was not in my list --- /cfif would work for you. Chris Christopher Conrad Victoria's Secret Catalogue http://www.VictoriasSecret.com Senior.Programmer.Analyst 614.337.5653 [EMAIL PROTECTED] -Original Message- From: Gilles Ratte [SMTP:[EMAIL PROTECTED]] Sent: Friday, July 07, 2000 10:52 AM To: 'cftalk' Subject: contained in a list I need know if a number is one of a list item. let me explain let's say.. mynumber = 2 ans mylist = 2,67,34,52 I thought this would do .. cfif #listcontains(mylist, mynumber)# is 0 ... cfelse ... /cfif but it does not act like I want ... It compare the same whay as of strings and will find 2 and 52 What I want to do is to get the exact item in the list Someone has an idea on how to do it? Thanks -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: contained in a list
You need ListFind(mylist, mynumber). ListFind looks for a string within the list, ListContains looks for a substring. Chris Evans [EMAIL PROTECTED] http://www.fuseware.com -Original Message- From: Gilles Ratte [mailto:[EMAIL PROTECTED]] Sent: Friday, July 07, 2000 10:52 AM To: 'cftalk' Subject: contained in a list I need know if a number is one of a list item. let me explain let's say.. mynumber = 2 ans mylist = 2,67,34,52 I thought this would do .. cfif #listcontains(mylist, mynumber)# is 0 ... cfelse ... /cfif but it does not act like I want ... It compare the same whay as of strings and will find 2 and 52 What I want to do is to get the exact item in the list Someone has an idea on how to do it? Thanks -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: contained in a list
Correct me if I'm wrong here people, but I believe that if the list contains actual numbers (like from a numeric data field) then this list function will work correctly, but if it's a text string it won't. It's been a while since I checked on this. -- Mark Warrick Phone: (714) 547-5386 Efax.com Fax: (801) 730-7289 Personal Email: [EMAIL PROTECTED] Personal URL: http://www.warrick.net Business Email: [EMAIL PROTECTED] Business URL: http://www.fusioneers.com ICQ: 346566 -- -Original Message- From: Gilles Ratte [mailto:[EMAIL PROTECTED]] Sent: Friday, July 07, 2000 7:52 AM To: 'cftalk' Subject: contained in a list I need know if a number is one of a list item. let me explain let's say.. mynumber = 2 ans mylist = 2,67,34,52 I thought this would do .. cfif #listcontains(mylist, mynumber)# is 0 ... cfelse ... /cfif but it does not act like I want ... It compare the same whay as of strings and will find 2 and 52 What I want to do is to get the exact item in the list Someone has an idea on how to do it? Thanks -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf _talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebarRstsbodyRsts/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: contained in a list
You need to append commas before and after mynumber, that way you are looking for ",2," not just "2". You might be able to do this within the cfif like this: cfif #listcontains(mylist, ","mynumber",")# is 0 but you will probably have to create another variable: cfset mynumfind=","mynumber"," and then use mynumfind in place of mynumber in the cfif statement. Also you will have to deal with the first and last numbers of the list since they are not surrounded by commas. The simplest way (if it won't screw up the list) would be to have the list start and end with a comma. There may be a more elegant way to do this using sql. -Original Message- From: Gilles Ratte [mailto:[EMAIL PROTECTED]] Sent: Friday, July 07, 2000 10:52 AM To: 'cftalk' Subject: contained in a list I need know if a number is one of a list item. let me explain let's say.. mynumber = 2 ans mylist = 2,67,34,52 I thought this would do .. cfif #listcontains(mylist, mynumber)# is 0 .. cfelse .. /cfif but it does not act like I want ... It compare the same whay as of strings and will find 2 and 52 What I want to do is to get the exact item in the list Someone has an idea on how to do it? Thanks -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.