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: Rich Text in DXL
Topic Summary:
Created On: 29-Oct-2007 14:42
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 Louie Landale, on Monday, October 29, 2007 7:19 PM

Answer:
>> Your print statement SHOULD be retrieving the raw text from the attribute. When I ran it it works that way. Compare these two statements:
[1] Text = obj."Object Text" // retrieves raw text
[2] Text = richText(obj."Object Text") // retrieves rich text

Are you SURE that attribute 'SW_CSC' doesn't contain odd rich text tags? Does it look right when you display it in a column?

>> If you truly have rich text, you can use the undocumented perm 'plainText' to convert it:
RichText = richText(obj."Object Text")
TextRaw = plainText(TextRich)

>> If you want some code to be generic and work whether its Layout, AttrDXL, or normal DXL, then you can do the following:
if (null obj)
{ // Normal DXL
}
elseif(null attrDXLName)
{ // Layout DXL
}
else
{ // Attr DXL
}
Keep in mind that variable 'obj' is globally defined and is set non-null for Layout and AttrDXL, and variable attrDXLName is globally defined and, if AttrDXL, contains the name of the attribute being modified.

- Louie
 29-Oct-2007 14:42
User is offline View Users Profile Print this message


Alan Huneke

Posts: 5
Joined: 3-Oct-2006

I am debugging a layout DXL script which fetches rich text. I copy the layout DXL script into a DXL interaction window to allow me to quickly debug it. Of course, I get the ugly rich text with all the formatting tags printing out. I'd like to either get just the plain text or formatted rich text in the DXL output window. I can't figure out how to do either. Here's what I've got:

if (name module local_o == "SRS") {

displayRich "{\\b \\i SW_CSC: } " probeRichAttr_(local_o,"SW_CSC", false)

if (debug) print "SW_CSC: " local_o."SW_CSC" "\n"  //***WANT THE local_o."SW_CSC" to be plain text***

}

Report this to a Moderator Report this to a Moderator
 29-Oct-2007 16:13
User is offline View Users Profile Print this message


Tony Goodman

Posts: 1098
Joined: 12-Sep-2002

Alan,

I would not try to debug layout DXL in the DXL interaction window.

Instead I would put your layout dxl code into a file, e.g. C:/test.dxl.

In the column add an include statement #include <c:/test.dxl>

Save the view.

Now you can edit the code in an editor of your choice rather than using the DXL interation window.

To force execution of the code simply reload the view.

When you are happy with the code, copy from the code from the file and paste into the column, replacing the include statement.

-------------------------
Tony Goodman
http://www.smartdxl.com
Report this to a Moderator Report this to a Moderator
 29-Oct-2007 18:02
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Answer Answer
>> Your print statement SHOULD be retrieving the raw text from the attribute. When I ran it it works that way. Compare these two statements:
[1] Text = obj."Object Text" // retrieves raw text
[2] Text = richText(obj."Object Text") // retrieves rich text

Are you SURE that attribute 'SW_CSC' doesn't contain odd rich text tags? Does it look right when you display it in a column?

>> If you truly have rich text, you can use the undocumented perm 'plainText' to convert it:
RichText = richText(obj."Object Text")
TextRaw = plainText(TextRich)

>> If you want some code to be generic and work whether its Layout, AttrDXL, or normal DXL, then you can do the following:
if (null obj)
{ // Normal DXL
}
elseif(null attrDXLName)
{ // Layout DXL
}
else
{ // Attr DXL
}
Keep in mind that variable 'obj' is globally defined and is set non-null for Layout and AttrDXL, and variable attrDXLName is globally defined and, if AttrDXL, contains the name of the attribute being modified.

- Louie
Report this to a Moderator Report this to a Moderator
 29-Oct-2007 19:26
User is offline View Users Profile Print this message


Alan Huneke

Posts: 5
Joined: 3-Oct-2006

Thanks Louie for the answer--plainText does what I asked for. You're correct--I was getting the tags from somewhere else (my example was a little too simplified) but plainText got rid of the junk in any case. Tony suggested what was a better approach regarding debug of layout DXL. My approach was kind of cludgy. Tony's method gets rid of the need for the debug hooks in the first place (and lets me use a decent editor). Thanks to you both! Al
Report this to a Moderator Report this to a Moderator
 29-Oct-2007 23:20
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

True for debugging and that's what I do; #include the file. But that's mainly so I can hit the DXL [Run] key which erases the DXL output pane, starting fresh with a new test.

However, as you know, leaving that #include statement in a deployed view is asking for trouble. Certainly if the #included file is on your PC then other folks who use the view won't see it. Even if you put it on the network there is no guarantee that EVERYONE who uses that module and that view will have R access to that network location.

No, layout and attr DXL (and Triggers) should be simple and contain all the code they need; nix any #include statements.

- Louie

Having said that ... I wonder the merits of having a layout open up some configuration file and execute that code... Naaaawwww...
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 2 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 2 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.