Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / January 2006



Tip: Looking for answers? Try searching our database.

Finding data in a comma delimited field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Richard Mossman - 30 Jan 2006 18:36 GMT
I have a comma-delimited list of UIDs in a field (named "planner_uid". This is
NOT the user id field that is used for security). I need to find out if the UID
of the person who is logged in (session.uid) is one of the UID's in the list.

I've tried using REFindNoCase, but it only returns a zero or non-zero. But,
then I can't figure out how to turn that information into "Yes, we have a
match". I've even tried REReplaceNoCase and tried matching what ends up in the
"buffers" created by the command. I guess the logic is just escaping me.

I'm hoping someone can help with either an explanation of a process, some code
examples, or both. Of course, I may be way off-base on the best solution. Trust
me, I'd rather get past the problem than set around with my "ego" up my b*t.

Of course, this is all being driven by a "looming" deadline. TIA
mattw - 30 Jan 2006 18:45 GMT
ListFind(planner_uid,session.uid) should return the position in the list of the found UID.

You can then get the uid from the list if need with ListGetAt(...)

matt
jdeline - 30 Jan 2006 18:48 GMT
What you have is a comma delimited list.  So search your list for the user id
in question.

<CFSET subjectUID = "jdeline">
<CFSET found = ListFindNoCase(myListOfUIDs, subjectUID)>
<CFIF found>
   <!--- the user is on the list --->
</CFIF>
Dan Bracuk - 30 Jan 2006 19:11 GMT
Originally posted by: Richard Mossman
I have a comma-delimited list of UIDs in a field (named "planner_uid". This is
NOT the user id field that is used for security). I need to find out if the UID
of the person who is logged in (session.uid) is one of the UID's in the list.

I've tried using REFindNoCase, but it only returns a zero or non-zero. But,
then I can't figure out how to turn that information into "Yes, we have a
match". I've even tried REReplaceNoCase and tried matching what ends up in the
"buffers" created by the command. I guess the logic is just escaping me.

I'm hoping someone can help with either an explanation of a process, some code
examples, or both. Of course, I may be way off-base on the best solution. Trust
me, I'd rather get past the problem than set around with my "ego" up my b*t.

Of course, this is all being driven by a "looming" deadline. TIA

You are way off base because your database is not normalized.  Normalize it
and you won't have these sorts of problems.  
mattw - 30 Jan 2006 20:53 GMT
Wow Dan, that comment is a little harsh and seems to be making some
assumptions. He didn't even mention a database. His 'field' of UIDs could be a
form field. Let's try to be little more helpful to our fellow CFers. Maybe try
something like, "If the ListFind() solutions don't work, you may have a more
serious problem with your database or application architecture. But not knowing
the setup of either, it is hard to say."
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.