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: Replacing a string by newline char
Topic Summary: Search&Replace
Created On: 9-Jun-2005 14:58
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.
 9-Jun-2005 14:58
User is offline View Users Profile Print this message


Christian Lintz

Posts: 2
Joined: 9-Jun-2005

When I import data from a spreadsheet I have the problem that if there are newlines in a column the Excel CSV export splits these columns and starts the second part in a new line. Directly such a file cannot be imported. Thus, I wrote a filter the replaces such new lines by a "
" and concatenates the lines. After importing to DOORS I want to automatically replace the
's by a newline char. Is this possible? Is it probably necessary to use a DXL script?

Thank you and Regards
Christian Lintz

Report this to a Moderator Report this to a Moderator
 9-Jun-2005 17:41
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Replacing text withing rich text strings is real tricky since you need to know to avoid the RT markup and only replace the raw text. You could use the "cutRichText" command to build the 3 parts of the new sting, but its indecies need to be based on the relative positions of the corresponding raw (non-RT) strings. Its a mess.
Report this to a Moderator Report this to a Moderator
 9-Jun-2005 18:10
User is offline View Users Profile Print this message


Mary Schweizer

Posts: 20
Joined: 20-Dec-2002

You can replace a special character with a carriage return, but you are right that you have to do it with a DXL script. Here is mine, that replaces an at sign (@) with carriage returns:

// File: at_signs_to_carriage_returns.dxl
// Author: Mary Schweizer
// Date: January 8, 2004
//
// This DXL script converts @ signs to carriage returns
// for a specified attribute in every DOORS rows in the
// current view.
//
// To run it:
// 1) select Tools->Edit DXL ...
// 2) Load this file in the DXL editor that pops up
// 3) Click the Run button.

Object o
Buffer temp_string = create // allocate memory
int i

for o in current Module do {
// ***************************************
// Change the attribute name on the line below
// to the attribute you want to change
// ***************************************
temp_string = o."Object Text" ""
i = contains(temp_string, '@', 0)
while (i > -1) {
set (temp_string, i, '\n')
i = contains(temp_string, '@', 0)
}
// ***************************************
// Change the attribute name on the line below
// to the attribute you want to change
// ***************************************
o."Object Text" = stringOf(temp_string)
}

delete temp_string // delete memory allocation

-------------------------
Mary Schweizer
BAE Systems
Report this to a Moderator Report this to a Moderator
 29-Jun-2005 09:27
User is offline View Users Profile Print this message


Christian Lintz

Posts: 2
Joined: 9-Jun-2005

Hello Mary,

sorry for the late reply. This one helps a lot. Thak you very much.

Regards
Christian
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.