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: DXL to compare child and parent text
Topic Summary:
Created On: 11-Dec-2008 17:29
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.
 11-Dec-2008 17:29
User is offline View Users Profile Print this message


Michael Venos

Posts: 20
Joined: 26-May-2004

I need to write a DXL to compare the object text of an object and the object text of an object that the object links to, and 1.) determine if there is a different between these two object texts, and 2.) ideally indicate what those differences are. Has any one done anything like this? Is there a DXL available that does something similar? Any ideas on how to best tackle this? Thanks in advance.
Report this to a Moderator Report this to a Moderator
 11-Dec-2008 17:30
User is offline View Users Profile Print this message


ron lewis

Posts: 650
Joined: 20-Sep-2004

look at diff function
Report this to a Moderator Report this to a Moderator
 11-Dec-2008 17:57
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

The 'diff' function compares two texts and produces a very nice red-lined difference between them. That difference can be put in an attribute, placed in a richText DBE, or exported to Word. Its very nice but not quite perfect.

As far as your DXL parsing the difference to find exact phrase changes, that's another matter. I'd practice with two texts that are slightly different and send the 'diff' to a *.txt file, and open it with Notepad. The texts should include some odd characters specifically including /\{}. Its somewhat possible you will see patterns and can write a DXL parser, probably finding which portions of the text are the same and deducing which are different. Good luck.

Be advised that 'diff' won't work on text that has rich text markup, so be sure to get the raw text from the attributes in question; Text1 = obj.MyAttr, do not get the rich text: Text1 = richText(obj.MyAttr).

- Louie
Report this to a Moderator Report this to a Moderator
 15-Dec-2008 16:50
User is offline View Users Profile Print this message


Michael Venos

Posts: 20
Joined: 26-May-2004

Hmmm. I'm a little confused on how to use the diff function. I'm starting off small trying to just comapre two attributes in the same module as below:

string sone = obj."Object Text"
string stwo = obj."newtext"
Buffer one = create
Buffer two = create
Buffer result = create
one = sone
two = stwo
diff(result, one, two, false)
display stringOf(result) "\n\n"
diff(result, one, two, true)
display stringOf(result)

But the results show up with what seems to be Rich text formatting like such:

{\rtf1\deff1000{\fonttbl{\f1016\fswiss\fcharset134 Tahoma;}{\f1015\fswiss\fcharset136 Tahoma;}{\f1014\fswiss\fcharset129 Tahoma;}{\f1013\fswiss\fcharset128 Tahoma;}{\f1012\fswiss\fcharset177 Arial;}{\f1011\fswiss\fcharset162 Arial;}{\f1010\fswiss\fcharset238 Arial;}{\f1009\fswiss\fcharset204 Arial;}{\f1008\fswiss\fcharset161 Arial;}{\f1007\fswiss\fcharset0 Arial;}{\f1006\froman\fcharset177 Times New Roman;}{\f1005\froman\fcharset162 Times New Roman;}{\f1004\froman\fcharset238 Times New Roman;}{\f1003\froman\fcharset204 Times New Roman;}{\f1002\froman\fcharset161 Times New Roman;}{\f1001\ftech\fcharset2 Symbol;}{\f1000\froman\fcharset0 Times New Roman;}}{{\colortbl ;\red255\green0\blue0;\red0\green255\blue0;\red0\green0\blue255;}

How do I get the results to show up with actual redlining in the DXL column? Or can I even do so? Thanks for any assistance.
Report this to a Moderator Report this to a Moderator
 15-Dec-2008 17:05
User is offline View Users Profile Print this message


Frank Jensen

Posts: 24
Joined: 18-Sep-2007

If you are using layout dxl - I suppose you are doing it because of the display statement in your code - you can display the text including markups by using displayRichWithColor.

Cheers,
Frank

-------------------------
Frank Jensen
TRW Automotive
frank.jensenREMOVE_ME@trw.com
Report this to a Moderator Report this to a Moderator
 15-Dec-2008 17:09
User is offline View Users Profile Print this message


Michael Venos

Posts: 20
Joined: 26-May-2004

That looks better. Excellent! Thanks everyone for your help and suggestions.
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.