Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: Parsing coma delimited list
Topic Summary:
Created On: 8-Jul-2003 13:19
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by Mike Conner, on Wednesday, July 9, 2003 4:46 PM

Answer:
Thank you Jonathan.

Your example was great and I was able to quickly solve my problem.

Thanks
 8-Jul-2003 13:19
User is offline View Users Profile Print this message


Mike Conner

Posts: 12
Joined: 22-Apr-2003

What is the best way to retieve items from a comma separated list? I have tried using Regexp of "(.*)," in a while statement but I always get the full line. Any ideas?
Report this to a Moderator Report this to a Moderator
 8-Jul-2003 16:27
User is offline View Users Profile Print this message


Chris Welch

Posts: 9
Joined: 27-Jan-2003

I've not done it via DXL but have in other VB/Basic script where the GetField() function makes it easy. If I had to do it via DXL I'd probably use ADO with the MS Text File Driver. I've posted a working example against MS-Access here a while ago that you should be able to find. You should be able to find ADO examples for reading the CSV online and tweak the sample code to do what you need.

Cheers,
Chris

Report this to a Moderator Report this to a Moderator
 9-Jul-2003 09:53
User is offline View Users Profile Print this message


Jonathan Marshall

Posts: 27
Joined: 10-Apr-2003

Mike

Regular expressions always try to match the longest possible piece of string. So if your string is "abc,def,ghi," then "(.*0)," will match the whole string. What you need to do is match an length of string which doesn't have commas in it "[^,]*"

As in:

string test = "abc,def,ghi"
Regexp reg = regexp "[^,]*"
while ((reg test) && (!null test)) {
print test[match 0] "\n"
test = test[end 0 + 2:]
}


Jonathan Marshall
EADS Astrium

-------------------------
Jonathan Marshall
EADS Astrium
Report this to a Moderator Report this to a Moderator
 9-Jul-2003 16:46
User is offline View Users Profile Print this message


Mike Conner

Posts: 12
Joined: 22-Apr-2003

Answer Answer
Thank you Jonathan.

Your example was great and I was able to quickly solve my problem.

Thanks
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.