Hello,
Buffer buff1 = create()
// print a brief report of the history record
void print(History h) {
HistoryType ht = h.type
buff1 += h.author "\t" h.date "\t" ht "\t"
if (ht == createType ||
ht == modifyType ||
ht == deleteType) { // attribute type
buff1 += h.typeName
} else if (ht == createAttr ||
ht == modifyAttr ||
ht == deleteAttr) {
// attribute definition
buff1 += h.attrName
} else if (ht == createObject ||
ht == clipCopyObject ||
ht == modifyObject) { // object
buff1 += h.absNo "\t"
if (ht==modifyObject) {
// means an attribute has changed
string oldV = h.oldValue
string newV = h.newValue
buff1 += " (" h.attrName ":" oldV " -> " newV ")"
}
}
buff1 += "\n"
displayRich( tempStringOf buff1)
}
// Main program
History h
for h in obj do print h
delete buff1
SystemAdmin - Wed Oct 05 23:22:31 EDT 2011 |
Re: Need help with Layout DXL and redline markup. Global buffer is effective, but when you WOULD have issued a create for it inside the function, you remember to erase it. In this case change "+=" to "=" line 5. From buff1 += h.author "\t" h.date "\t" ht "\t" To buff1 = h.author "\t" h.date "\t" ht "\t"
bufOld = h.plainOldValue bufNew = h.plainNewValue diff(bufOld, bufNew, bufDiff) buff1 += bufDiff
|
Re: Need help with Layout DXL and redline markup. |
Re: Need help with Layout DXL and redline markup.
I found a better example to work from currently I am trying to print the link history but when I run the script I get an run-time error "-R-W- DXL: <Line:5> wrong history type deleteLink for Link Initial Name Backtrace:" any ideas how would you print the redline mark-up for the link history? Any ideas how to improve the current code for execution time?
void defaultDescribeEvent(Object o, string sAttribute, History h, Buffer b)
{
HistoryType ht = null; ht = h.type;
Buffer v = create()
Buffer old = create(); old = h.plainOldValue;
Buffer new = create(); new = h.plainNewValue;
diff (v, old,new, "\\cf1\\strike ", "\\cf3\\ul ")
if (ht == modifyObject)
{
b += "{\\b On }"
Date d = h.date
b += d ""
b += " {\\b "
b += h.author ""
b += "} "
// object modification has old and new values
b += " {\\b "
b += h.attrName "} "
b += " \\par "
b += v
b += " \\par "
}else if (ht == deleteLink || ht == createLink)
{
b += "{\\b On }"
Date d = h.date
b += d ""
b += " {\\b "
b += h.author ""
b += "} "
// object modification has old and new values
b += " {\\b "
b += goodStringOf(ht) "} "
b += " \\par "
b += v
b += " \\par "
}
delete old
delete new
delete v
}
string getHistoryForAttributes(Object o, void describeEvent(Object, string, History, Buffer))
{
History h = null
Buffer b = create()
for h in o do
{
if(h.readlocked)
continue
string sAttribute = h.attrName
describeEvent(o, sAttribute, h, b)
}
string sHistory = stringOf(b)
delete b
return sHistory
}
displayRichWithColour getHistoryForAttributes(obj, defaultDescribeEvent)
|
Re: Need help with Layout DXL and redline markup. SystemAdmin - Fri Oct 07 01:55:41 EDT 2011
I found a better example to work from currently I am trying to print the link history but when I run the script I get an run-time error "-R-W- DXL: <Line:5> wrong history type deleteLink for Link Initial Name Backtrace:" any ideas how would you print the redline mark-up for the link history? Any ideas how to improve the current code for execution time?
void defaultDescribeEvent(Object o, string sAttribute, History h, Buffer b)
{
HistoryType ht = null; ht = h.type;
Buffer v = create()
Buffer old = create(); old = h.plainOldValue;
Buffer new = create(); new = h.plainNewValue;
diff (v, old,new, "\\cf1\\strike ", "\\cf3\\ul ")
if (ht == modifyObject)
{
b += "{\\b On }"
Date d = h.date
b += d ""
b += " {\\b "
b += h.author ""
b += "} "
// object modification has old and new values
b += " {\\b "
b += h.attrName "} "
b += " \\par "
b += v
b += " \\par "
}else if (ht == deleteLink || ht == createLink)
{
b += "{\\b On }"
Date d = h.date
b += d ""
b += " {\\b "
b += h.author ""
b += "} "
// object modification has old and new values
b += " {\\b "
b += goodStringOf(ht) "} "
b += " \\par "
b += v
b += " \\par "
}
delete old
delete new
delete v
}
string getHistoryForAttributes(Object o, void describeEvent(Object, string, History, Buffer))
{
History h = null
Buffer b = create()
for h in o do
{
if(h.readlocked)
continue
string sAttribute = h.attrName
describeEvent(o, sAttribute, h, b)
}
string sHistory = stringOf(b)
delete b
return sHistory
}
displayRichWithColour getHistoryForAttributes(obj, defaultDescribeEvent)
No books available for DOORS DXL, sorry. The only booklike thing is the DXL Help / DXL Reference manual supplied along with DOORS. Websites: http://www.smartdxl.com/ - Excellent collection of scripts and a small, not so active forum http://www.baselinesinc.com/ - see DXL Tutorial http://www.baselinesinc.com/?p=9&cpage=1, also has a small collection of scripts http://www.ibm.com/developerworks/forums/forum.jspa?forumID=1527 - most active DXL forum by IBM http://easyweb.easynet.co.uk/~iany/consultancy/papers.htm - some white papers on getting started with DXL http://www.galactic-solutions.com/GalacticWhitePapers.htm - advanced DXL stuff and excellent collection of scripts |
Re: Need help with Layout DXL and redline markup. SystemAdmin - Fri Oct 07 01:55:41 EDT 2011
I found a better example to work from currently I am trying to print the link history but when I run the script I get an run-time error "-R-W- DXL: <Line:5> wrong history type deleteLink for Link Initial Name Backtrace:" any ideas how would you print the redline mark-up for the link history? Any ideas how to improve the current code for execution time?
void defaultDescribeEvent(Object o, string sAttribute, History h, Buffer b)
{
HistoryType ht = null; ht = h.type;
Buffer v = create()
Buffer old = create(); old = h.plainOldValue;
Buffer new = create(); new = h.plainNewValue;
diff (v, old,new, "\\cf1\\strike ", "\\cf3\\ul ")
if (ht == modifyObject)
{
b += "{\\b On }"
Date d = h.date
b += d ""
b += " {\\b "
b += h.author ""
b += "} "
// object modification has old and new values
b += " {\\b "
b += h.attrName "} "
b += " \\par "
b += v
b += " \\par "
}else if (ht == deleteLink || ht == createLink)
{
b += "{\\b On }"
Date d = h.date
b += d ""
b += " {\\b "
b += h.author ""
b += "} "
// object modification has old and new values
b += " {\\b "
b += goodStringOf(ht) "} "
b += " \\par "
b += v
b += " \\par "
}
delete old
delete new
delete v
}
string getHistoryForAttributes(Object o, void describeEvent(Object, string, History, Buffer))
{
History h = null
Buffer b = create()
for h in o do
{
if(h.readlocked)
continue
string sAttribute = h.attrName
describeEvent(o, sAttribute, h, b)
}
string sHistory = stringOf(b)
delete b
return sHistory
}
displayRichWithColour getHistoryForAttributes(obj, defaultDescribeEvent)
Also, in a strange twist of reality, the linkInitialName and targetInitialName properties are only readable by the Administrator. However, I have found you can always trap such h.property query errors with noError() and lastError(). So if you initialize your variables with null values when you declare them, then have all your functions put noError() at the top and lastError() at the bottom, at least your code will come to a graceful end even if you don't get the information you are seeking.
I actually wrote a big script that searched my database for all History, and when I encountered a new History Type I'd query it with all the Properties, and keep track of which ones were illegal for which HistoryType. Took that information and coded it into my various functions, but alas then lost it the original list. |
Re: Need help with Layout DXL and redline markup. llandale - Fri Oct 07 13:33:43 EDT 2011
I actually wrote a big script that searched my database for all History, and when I encountered a new History Type I'd query it with all the Properties, and keep track of which ones were illegal for which HistoryType. Took that information and coded it into my various functions, but alas then lost it the original list.
Hello,
void defaultDescribeEvent(Object o, History h, Buffer b)
{
HistoryType ht = h.type
Date d = h.date
b += "{\\b On }" d " {\\b " h.author "} " goodStringOf(ht) ""
if (ht == createLink || ht == deleteLink) { b += " \\par " h.targetInitialName "/" h.targetAbsNo ""}
// means an attribute has changed
if (ht == modifyObject)
{
Buffer v = create()
Buffer old = create(); old = h.plainOldValue;
Buffer new = create(); new = h.plainNewValue;
// redline markup
diff (v, old, new, "\\cf1\\strike ", "\\cf3\\ul ")
b += " {\\b " h.attrName "} " " \\par " v " \\par "
delete old
delete new
delete v
}
else
{
b += " \\par "
}
}
string getHistoryForAttributes(Object o, void describeEvent(Object, History, Buffer))
{
History h = null
Buffer b = create()
for h in o do
{
if(h.readlocked)
continue
describeEvent(o, h, b)
}
string sHistory = stringOf(b)
delete b
return sHistory
}
displayRichWithColour getHistoryForAttributes(obj, defaultDescribeEvent)
|
Re: Need help with Layout DXL and redline markup. SystemAdmin - Sun Oct 09 16:29:19 EDT 2011
Hello,
void defaultDescribeEvent(Object o, History h, Buffer b)
{
HistoryType ht = h.type
Date d = h.date
b += "{\\b On }" d " {\\b " h.author "} " goodStringOf(ht) ""
if (ht == createLink || ht == deleteLink) { b += " \\par " h.targetInitialName "/" h.targetAbsNo ""}
// means an attribute has changed
if (ht == modifyObject)
{
Buffer v = create()
Buffer old = create(); old = h.plainOldValue;
Buffer new = create(); new = h.plainNewValue;
// redline markup
diff (v, old, new, "\\cf1\\strike ", "\\cf3\\ul ")
b += " {\\b " h.attrName "} " " \\par " v " \\par "
delete old
delete new
delete v
}
else
{
b += " \\par "
}
}
string getHistoryForAttributes(Object o, void describeEvent(Object, History, Buffer))
{
History h = null
Buffer b = create()
for h in o do
{
if(h.readlocked)
continue
describeEvent(o, h, b)
}
string sHistory = stringOf(b)
delete b
return sHistory
}
displayRichWithColour getHistoryForAttributes(obj, defaultDescribeEvent)
To get the "inlink" history you will need to go to the other object (source of links) and look for its outlink history, then the target of that history, and if it's your original object then display it. Seems to me there are some problems with that, perhaps it's best if you just get the lnk."Created On" value and put that in your report.
|