Problem
A Layout DXL Column script should show the differences to another baseline
Approach
- Right-click column header
- Select „New“
- Choose „Layout DXL“ radio button
- Click on the browser button
- Click on New
- Insert the script below
- Be aware to have all line breaks in the code like below
Replace {baselineToCompare} to the major version that you want to compare with the current version.
Solution
// This script shall be replace {baselineToCompare}
/**************************************************
* Author: Björn Karpenstein
* Date: 2014-10-09
*
* This is a layout DXL to show the differences from
* the current version to another baseline.
**************************************************/
Baseline oldBaseline = baseline({baselineToCompare}, 0,"");
Buffer bBefore = create;
Buffer bAfter = create;
Buffer result = create;
AttrDef ad;
Module oldModule = load(module(obj), oldBaseline, false)
Module currModule = current
showDeletedObjects(true)
int i = obj."Absolute Number"
Object oldObject = object(i, oldModule)
void compareColumn(string columnName)
{
ad = find(oldModule, columnName);
if(!null(ad) && !null(oldObject))
{
bBefore = oldObject.columnName;
}
else bBefore = "";
ad = find(currModule, columnName)
if(!null(ad))
{
bAfter = obj.columnName;
}
else bAfter = "";
bAfter = obj.columnName;
if( bBefore != bAfter )
{
diff(result, bBefore, bAfter);
displayRichWithColor("{\\b " columnName " CHANGED}");
displayRichWithColor(stringOf(result));
}
}
if(null(oldObject))
{
displayRichWithColor("{\\b NEW}");
if(isDeleted(obj)) displayRichWithColor("{\\b DELETED}");
}
else
{
if(isDeleted(obj) && !isDeleted(oldObject))
{
displayRichWithColor("{\\b DELETED}");
}
else
{
if(!isDeleted(obj) && isDeleted(oldObject))
{
displayRichWithColor("{\\b UNDELETED}");
}
// Here you can add the
// module attributes to compare
/*** BB_ReqStatus ***/
compareColumn("BB_ReqStatus");
/*** BB_Type ***/
compareColumn("BB_Type");
/*** Last Modified On ***/
compareColumn("Last Modified On");
/*** Object Heading ***/
compareColumn("Object Heading");
/*** Object Text ***/
compareColumn("Object Text");
}
}
delete bBefore;
delete bAfter;
delete result;