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: diff function
Topic Summary:
Created On: 20-Apr-2004 17:24
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 Jonathan Marshall, on Wednesday, April 21, 2004 1:42 PM

Answer:
Pieter,

The attached file is a modified baseline comparison script which outputs to an rtf file which you can view in Word. Object text is compared using the diff function.

Jon
 20-Apr-2004 17:24
User is offline View Users Profile Print this message


Pieter DE WAARD

Posts: 73
Joined: 11-Jul-2003

Does anybody have a simple example of how the diff function works for showing "red-lining" ? Care to share it? Can't seem to get it working from th DXL manual ...


Thanks,

- Pieter

-------------------------
Pieter de Waard
www.nhindustries.com
Report this to a Moderator Report this to a Moderator
 21-Apr-2004 10:08
User is offline View Users Profile Print this message


Jonathan Marshall

Posts: 27
Joined: 10-Apr-2003

Answer Answer
Pieter,

The attached file is a modified baseline comparison script which outputs to an rtf file which you can view in Word. Object text is compared using the diff function.

Jon

-------------------------
Jonathan Marshall
EADS Astrium
Report this to a Moderator Report this to a Moderator
 21-Apr-2004 11:12
User is offline View Users Profile Print this message


Pieter DE WAARD

Posts: 73
Joined: 11-Jul-2003

Thanks Jon. This a very usefull script that we'll use for DOORS-averse users in our community.


-------------------------
Pieter de Waard
www.nhindustries.com

Edited: 21-Apr-2004 at 13:49 by Pieter DE WAARD
Report this to a Moderator Report this to a Moderator
 23-May-2004 16:10
User is offline View Users Profile Print this message


Dave Robbins

Posts: 36
Joined: 9-Dec-2003

Attached is a simple layout DXL fn that shows changes in the current Module using the diff function.

To show changes in Attributes other than Object Text,Heading & Type, just add your own ones in the array in line 1.

The actual diff is @ line 119.

We use this as part of a 'Manage Changes' view and have set up a filter which just shows Objects with any text in this column ( layout DXL ). The View also has deletes showing an these are also reported by the layout DXL.

One thing I failed to get working, was the colour of the redlines in the Layout DXL. How do I get coloured text?

regards,

-------------------------
Dave
+44 (0)23 9270 5711
david.robbins@astrium.eads.net
~~~~~~~~~~~~~~~~~~~~
EADS Astrium, Anchorage Road
Portsmouth. Hampshire. UK PO3 5PU

Edited: 23-May-2004 at 21:11 by Dave Robbins
Report this to a Moderator Report this to a Moderator
 23-May-2004 21:08
User is offline View Users Profile Print this message


Dave Robbins

Posts: 36
Joined: 9-Dec-2003

string attributeToGetHistoryFrom[] = { "Object Heading", "Object Text", "Object Type" }
// just add any new Attributes you want history displayed on into this array ^^^^^^^^^^^^^^^^^^^^^^^^^

// Layout DXL to display simple history/changes


/*
AUTHOR: Dave Robbins

DATE: 24/05/04

FILE LOCATION:

DESCRIPTION:

This function runs as Layout DXL:

** Displays information on any new Objects
** Displays information on any changed Objects
** Displays information on any deleted Objects

The View using this Layout DXL should filter on this column so just the changes are presented

Presentation:

Known issues/limitations:

** Uses new V7 'diff' function so won't work on pre-V7 Modules

The script is not able to:



*/

/*************************************************************************
CHANGES
**************************************************************************
VERSION AUTHOR DATE DESCRIPTION/REASON
0.1 DIR 24/05/04 First issue

*************************************************************************/
// globals
// moved to top for ease of changing by any Users

// functions

////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
string getDeletedObjectInfo( Object o ) {

string returnString = ""
History hr

for hr in o do {

HistoryType ht = hr.type

if( ht == deleteObject ) {
// if in this condition, then there is relevent history to report...

returnString = "Deleted by: " hr.author " on: " hr.date ""
// get last deletion in case there has been some fannying about with the deletion...

}
}

return returnString
} // end getDeletedObjectInfo
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
string baselineState( Buffer &returnBuff, string attributeToProbe, Object o ) {

string returnString = ""
History hr

for hr in o do {

HistoryType ht = hr.type

if( ht == modifyObject && hr.attrName == attributeToProbe ) {
// if in this condition, then there is relevent history to report...

string oldV = hr.plainOldValue
string newV = hr.plainNewValue

if( !null oldV ) { // changed data state
returnBuff += oldV // only interested in original data
returnString = "has changed"
break // got the first data so can quit out
}else { // new data state
returnBuff += oldV // only interested in original data
returnString = "is new"
break // got the first data so can quit out
}
}
}

return returnString
} // end baselineState
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
Buffer currentState( string attributeToProbe, Object o ) {

Buffer returnBuff = create()
returnBuff += probeAttr_(o,attributeToProbe)

return returnBuff
delete returnBuff // finished with the Buffer
} // end currentState
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
string diffAttribute( Buffer &resBuf, string attributeToDiff, string &changeType, Object o ) {

string returnString = ""
Buffer originalText = create()
changeType = baselineState( originalText, attributeToDiff, o )

returnString = diff(resBuf, originalText, currentState( attributeToDiff, o ), "\\cf1\\strike ", "\\cf3\\ul ") ""
// new V7 function

return returnString
} // end diffAttribute
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
Buffer getHistoryForAttributes( Object o, string attributeToGetHistoryFromArray[] ) {

Buffer returnBuff = create()
int sizeOfArray = sizeof attributeToGetHistoryFromArray
int everyEntryInArray

if( !isDeleted( o ) ) { // all bets off if Object has been deleted

// rattle through attributes array to get history from
for (everyEntryInArray=0; everyEntryInArray < sizeOfArray; everyEntryInArray++) {

string attributeToGetAnyChangesFrom = attributeToGetHistoryFromArray[ everyEntryInArray ];
if( exists attribute attributeToGetAnyChangesFrom ) { // Only proceed if valid attribute

Buffer resBuf = create()
string changeType = ""

string errMess = diffAttribute( resBuf, attributeToGetAnyChangesFrom, changeType, o )


if( null errMess && !null changeType ) {

returnBuff += "\nAttribute '" attributeToGetAnyChangesFrom "' {\\b " changeType ":}\n"
returnBuff += resBuf
returnBuff += "\n\n"


}
delete resBuf
}
}

} else {

returnBuff += "Object# " o."Absolute Number" " {\\b has been deleted.}\n"
returnBuff += getDeletedObjectInfo( o ) "\n"


}
return returnBuff
delete returnBuff
} // end getHistoryForAttributes
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
// main program

//Object obj = current // obj already defined in layout DXL
//print stringOf( getHistoryForAttributes( obj, attributeToGetHistoryFrom ) )
displayRich stringOf( getHistoryForAttributes( obj, attributeToGetHistoryFrom ) )

////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////

-------------------------
Dave
+44 (0)23 9270 5711
david.robbins@astrium.eads.net
~~~~~~~~~~~~~~~~~~~~
EADS Astrium, Anchorage Road
Portsmouth. Hampshire. UK PO3 5PU
Report this to a Moderator Report this to a Moderator
 25-Apr-2006 00:58
User is offline View Users Profile Print this message


Kim Turner

Posts: 20
Joined: 28-Apr-2005

Jon,

You stated in a previous (dated) post:

quote:

The attached file is a modified baseline comparison script which outputs to an rtf file which you can view in Word. Object text is compared using the diff function.


Can you re-post this script, or tell me where I can find it at?

Thanks,

Kim Turner
Orbital Sciences Corp.
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 0 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 0 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.