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: Handling the backslash in a string concatenation
Topic Summary:
Created On: 25-Jul-2008 18:59
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 Pranav Chandrasekhar, on Friday, July 25, 2008 8:00 PM

Answer:
Hi David,
Thank you for your prompt and helpful response to my post. I didn't realize the script could actually read the file path in its non-DXL form and automatically interpret it correctly. It saves me a lot of work. Thank you for your help.

Regards,

Pranav
 25-Jul-2008 18:59
User is offline View Users Profile Print this message


Pranav Chandrasekhar

Posts: 101
Joined: 16-May-2006

Hi All,
I have a quick question. I am writing a script that reads the file path of an export location from a module attribute in a formal module. The default location for the csv export for this module is captured in this module attribute. In DXL, a file path has the following format:

C:\\data\\Metrics

but since our requirements engineers do not know this, it likely that they will store the following in the module attribute.

c:\data\Metrics

I have written a DXL function to convert the path above to correct path that is recognizable in DXL.

I have attached the code to this post. I keep getting errors indicating "badly formed tokens". If you have any ideas/suggestions as to how I might circumvent this issue, please do let me know. Thank you.

Regards,

Pranav
Report this to a Moderator Report this to a Moderator
 25-Jul-2008 19:32
User is offline View Users Profile Print this message


David Jakad

Posts: 94
Joined: 20-Jul-2007

In your DXL, you have to escape a backslash with a backslash.

So...

"D:\Test Project\sampleexport.CSV" becomes "D:\\Test Project\\sampleexport.CSV"

if(temp == "\") becomes if(temp == "\\")

Be aware that esaping backslashes is only necessary in your DXL script. If you "get" the string directly from the attribute and assign it directly to a string variable, escaping is not necessary. Escaping of backslahses is only necessary in the hard-coded strings in your DXL script. See the attached modified code. See print "Test 1" and "Test 2" at the bottom. Both print the same result. You'll see that print "Test 1" already strips out the double-backslashes.
Report this to a Moderator Report this to a Moderator
 25-Jul-2008 20:00
User is offline View Users Profile Print this message


Pranav Chandrasekhar

Posts: 101
Joined: 16-May-2006

Answer Answer
Hi David,
Thank you for your prompt and helpful response to my post. I didn't realize the script could actually read the file path in its non-DXL form and automatically interpret it correctly. It saves me a lot of work. Thank you for your help.

Regards,

Pranav
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.