ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 13th, 2005, 01:14 PM
mparker1113 mparker1113 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 254 mparker1113 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 29 m 48 sec
Reputation Power: 5
parsing string variables using CF 4.1.xx

Hi,

I am passing id's for records that I want in the url. I have the id's delimeted by a "|". I can parse these using javascript, but I need to use each one so that I can have my query select only records with those ids.

I am not familiar with cf string manipulating methods, and have not found a good solution yet.

Anyone know a good way to get these record ids ?

They are in this format: http://www.mysite.cfm?ids=1|2|4|7

Thanks for any input.

Reply With Quote
  #2  
Old June 13th, 2005, 01:47 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,689 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 16 h 33 m 51 sec
Reputation Power: 53
The easiest way is probably to treat it as a pipe-delimited list. Check the list functions in the docs.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old June 13th, 2005, 02:06 PM
mparker1113 mparker1113 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 254 mparker1113 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 29 m 48 sec
Reputation Power: 5
Thanks for the input--I am glad there is a way.

I went to Macromedia, and searched google, but don't see a good tutorial for pipe-delimeted list methods in ColdFusion.

How do I get started using this method?

Reply With Quote
  #4  
Old June 13th, 2005, 02:21 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,689 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 16 h 33 m 51 sec
Reputation Power: 53
For example, to get the second element in your list you would do

#listGetAt( url.ids, 2, '|' )#

These functions are covered in detail in the docs.

Reply With Quote
  #5  
Old June 15th, 2005, 11:36 AM
mparker1113 mparker1113 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 254 mparker1113 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 29 m 48 sec
Reputation Power: 5
How about if I wanted to do a foreach id in #listGetAt( url.ids)# type of application.

What method/procedure call be that would work for that?

Reply With Quote
  #6  
Old June 15th, 2005, 11:56 AM
mparker1113 mparker1113 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 254 mparker1113 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 29 m 48 sec
Reputation Power: 5
<cfset idsNumber = ListValueCount(url.ids,"|")> isn't working for me either.

I just need to be able to count and identify the number of id's that I have in the URL that are separated by the "|" character.

Reply With Quote
  #7  
Old June 15th, 2005, 12:12 PM
mparker1113 mparker1113 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 254 mparker1113 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 29 m 48 sec
Reputation Power: 5
OK -- I'm set.

I used the code you sent and some googling to figure out how to convert the url.ids to an array with ListToArray().

Now I can just index through the array using a for loop and #ArrayLen# of my array.

Thanks for input.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > parsing string variables using CF 4.1.xx


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT