Link History Details

All,

I thought this would be easy but I can't seem to find the answer.

Via DXL, I want to get details for link history. If the history type is createLink, I want to know the target module.

Here's the clincher, I want normal users to be able to run this DXL as a report.

Is this possible? It would seem to me it is, because when you click on the history tab in the object properties window you can see all the details.

If this isn't possible with the known DXL functions, then what the heck good is link history if I can't report on it in a custom way?

I appreciate any feedback.
kbmurphy - Tue May 26 12:35:31 EDT 2009

Re: Link History Details
SystemAdmin - Tue May 26 12:46:08 EDT 2009

For some reason that information is so sensitive in a DXL script output that those functions can be only run by the Administrator.

Re: Link History Details
SystemAdmin - Tue May 26 12:54:24 EDT 2009

SystemAdmin - Tue May 26 12:46:08 EDT 2009
For some reason that information is so sensitive in a DXL script output that those functions can be only run by the Administrator.

Copying my post from the old forum:

Here is the Layout DXL code for a column showing link history details for out-going links (based on code examples found in this forum):


Object o = obj
History h = null

void ShowHistory(History h)
{
HistoryType ht = h.type
int targetNum = 0

if ((ht == modifyLink) || (ht == createLink) || (ht == deleteLink))
{
targetNum = h.targetAbsNo
display h.author "\t" h.date "\t" stringOf(ht) " to: " targetNum ""
}
}

for h in o do ShowHistory(h)

For this to work your modules should have the Link history generation selected in Module Properties. The script shows history for link changes in the current module, not the history items in the baselines.

The trouble with link history is that for some reason the module names linked to or link module names used are only available for the Administrator. So you can try to access h.linkInitialName and h.targetInitialName but you will get only DXL errors if you are not running the code as Administrator.

Re: Link History Details
kbmurphy - Tue May 26 13:02:45 EDT 2009

SystemAdmin - Tue May 26 12:54:24 EDT 2009
Copying my post from the old forum:

Here is the Layout DXL code for a column showing link history details for out-going links (based on code examples found in this forum):


Object o = obj
History h = null

void ShowHistory(History h)
{
HistoryType ht = h.type
int targetNum = 0

if ((ht == modifyLink) || (ht == createLink) || (ht == deleteLink))
{
targetNum = h.targetAbsNo
display h.author "\t" h.date "\t" stringOf(ht) " to: " targetNum ""
}
}

for h in o do ShowHistory(h)

For this to work your modules should have the Link history generation selected in Module Properties. The script shows history for link changes in the current module, not the history items in the baselines.

The trouble with link history is that for some reason the module names linked to or link module names used are only available for the Administrator. So you can try to access h.linkInitialName and h.targetInitialName but you will get only DXL errors if you are not running the code as Administrator.

Pekka,

That is what I thought, but I wanted to confirm it.

This is ridiculous. First, you know that you don't have to be an administrator to get this information because regular users can see the information. It just doesn't make sense and it breaks the history function, in my opinion.

I have a client who is wanting a report of all the links created in to a given module after a certain date. Since the "date" is an input, he needs to be able to run this whenever he wants with a different value.

There is no purpose for this that I can gather. The information is plainly available to all users! So frustrating.

Re: Link History Details
llandale - Tue May 26 15:42:24 EDT 2009

If you select an object with an outlink the following snippette will dump the info you want:

History    hst
 
for hst in (current Object) do
{  if (hst.type == createLink)
      print "^" (hst.linkInitialName) "^\t[" (hst.targetInitialName) "]\t*" (hst.targetAbsNo) "*\n"
}

 


However, I see that the first two generate errors unless the user is the Administrator; VERY curious indeed. You need to routinely trap history access errors with noError() and lastError().

I see there is also properies 'linkVersion' and 'targetVersion'.

-Louie

 

Re: Link History Details
faisal.zahidi@boeing.com - Mon Jan 18 13:26:40 EST 2010

SystemAdmin - Tue May 26 12:54:24 EDT 2009
Copying my post from the old forum:

Here is the Layout DXL code for a column showing link history details for out-going links (based on code examples found in this forum):


Object o = obj
History h = null

void ShowHistory(History h)
{
HistoryType ht = h.type
int targetNum = 0

if ((ht == modifyLink) || (ht == createLink) || (ht == deleteLink))
{
targetNum = h.targetAbsNo
display h.author "\t" h.date "\t" stringOf(ht) " to: " targetNum ""
}
}

for h in o do ShowHistory(h)

For this to work your modules should have the Link history generation selected in Module Properties. The script shows history for link changes in the current module, not the history items in the baselines.

The trouble with link history is that for some reason the module names linked to or link module names used are only available for the Administrator. So you can try to access h.linkInitialName and h.targetInitialName but you will get only DXL errors if you are not running the code as Administrator.

I need to display the link history in an layout dxl column. The following code works fine except that I want to display the object identifier for the target object(not the absolute number, targetNum ). any help is appreciated!
Object o = obj
History h = null

void ShowHistory(History h)
{
HistoryType ht = h.type
int targetNum = 0

if ((ht == modifyLink) || (ht == createLink) || (ht == deleteLink))
{
targetNum = h.targetAbsNo
display h.author "\t" h.date "\t" stringOf(ht) " to: " targetNum ""
}
}

for h in o do ShowHistory(h)

Re: Link History Details
llandale - Mon Jan 18 15:43:01 EST 2010

faisal.zahidi@boeing.com - Mon Jan 18 13:26:40 EST 2010
I need to display the link history in an layout dxl column. The following code works fine except that I want to display the object identifier for the target object(not the absolute number, targetNum ). any help is appreciated!
Object o = obj
History h = null

void ShowHistory(History h)
{
HistoryType ht = h.type
int targetNum = 0

if ((ht == modifyLink) || (ht == createLink) || (ht == deleteLink))
{
targetNum = h.targetAbsNo
display h.author "\t" h.date "\t" stringOf(ht) " to: " targetNum ""
}
}

for h in o do ShowHistory(h)

History doesn't remember that.

Before your loop, you'll have to open up all modules that are targets of links; the DXL manual has an example of that. Then get the 'Prefix' of all those modules and store them along with the module names.

For each History, get the name of the module for the link, which I think is hst.targetInitialName. Find that module's Prefix, then

display "to " ModPrefix targetNum ""

  • Louie

Re: Link History Details
faisal.zahidi@boeing.com - Mon Jan 18 18:38:56 EST 2010

llandale - Mon Jan 18 15:43:01 EST 2010
History doesn't remember that.

Before your loop, you'll have to open up all modules that are targets of links; the DXL manual has an example of that. Then get the 'Prefix' of all those modules and store them along with the module names.

For each History, get the name of the module for the link, which I think is hst.targetInitialName. Find that module's Prefix, then

display "to " ModPrefix targetNum ""

  • Louie

Louie,

thanks for your suggestion.
Per your suggestion, I looped thru the links and tried to load the target module name and prefix in a skiplist. However, I can't get the name of the module for link in the history. The hst.targetInitialName function doesnot work. My plan is to search the name of the module for link in the skiplist and place the associated prefix for the module in DisplayRich...here is my code.

History h
HistoryType ht
Object o = obj
Skip skprfix=createString
Object trgObj
string trgpfx

void modhist(Object obj)
{
delete skprfix
skprfix=createString

Link lnk
Module targetMod

for lnk in obj->"*" do
{
targetMod=target lnk
trgpfx=targetMod."Prefix"
put(skprfix,name(targetMod),trgpfx)
}
}

int targetNum = 0
Date d = "23 October 2008"
Buffer r = create(0)
Buffer s = create(0)
Buffer t = create(0)
for h in o do
{
if (h.date >= d)
{
if (h.type "" == "createObject") displayRich "{\\b Created on " h.date "}"
if (h.type "" == "modifyObject" && (h.attrName "" == "Object Text" or h.attrName "" == "Object Heading" or h.attrName "" == "RM Verification Method" or h.attrName "" == "RM Verification Level"))
{
displayRich "{\\b " h.attrName "} Changed on " h.date " By: " h.author ""
t += (string h.plainOldValue)
s += (string h.plainNewValue)

diff(r, t, s,"\\cf1\\strike ", "\\cf3\\ul ")
if (s != t) displayRichWithColor stringOf(r)
}
int targetNum = 0

if ((h.type== modifyLink) || (h.type == createLink) || (h.type == deleteLink))
{
targetNum = h.targetAbsNo

modhist(o)
displayRich "Changed on " h.date " By: " h.author "" "\t" "{\\b " stringOf(h.type) " to: } " targetNum ""
}

display "\n"
length(r,0)
length(s,0)
length(t,0)
}
}

Look forward to hearing from you.

thanks,

FZ

Re: Link History Details
llandale - Tue Jan 19 17:23:24 EST 2010

faisal.zahidi@boeing.com - Mon Jan 18 18:38:56 EST 2010
Louie,

thanks for your suggestion.
Per your suggestion, I looped thru the links and tried to load the target module name and prefix in a skiplist. However, I can't get the name of the module for link in the history. The hst.targetInitialName function doesnot work. My plan is to search the name of the module for link in the skiplist and place the associated prefix for the module in DisplayRich...here is my code.

History h
HistoryType ht
Object o = obj
Skip skprfix=createString
Object trgObj
string trgpfx

void modhist(Object obj)
{
delete skprfix
skprfix=createString

Link lnk
Module targetMod

for lnk in obj->"*" do
{
targetMod=target lnk
trgpfx=targetMod."Prefix"
put(skprfix,name(targetMod),trgpfx)
}
}

int targetNum = 0
Date d = "23 October 2008"
Buffer r = create(0)
Buffer s = create(0)
Buffer t = create(0)
for h in o do
{
if (h.date >= d)
{
if (h.type "" == "createObject") displayRich "{\\b Created on " h.date "}"
if (h.type "" == "modifyObject" && (h.attrName "" == "Object Text" or h.attrName "" == "Object Heading" or h.attrName "" == "RM Verification Method" or h.attrName "" == "RM Verification Level"))
{
displayRich "{\\b " h.attrName "} Changed on " h.date " By: " h.author ""
t += (string h.plainOldValue)
s += (string h.plainNewValue)

diff(r, t, s,"\\cf1\\strike ", "\\cf3\\ul ")
if (s != t) displayRichWithColor stringOf(r)
}
int targetNum = 0

if ((h.type== modifyLink) || (h.type == createLink) || (h.type == deleteLink))
{
targetNum = h.targetAbsNo

modhist(o)
displayRich "Changed on " h.date " By: " h.author "" "\t" "{\\b " stringOf(h.type) " to: } " targetNum ""
}

display "\n"
length(r,0)
length(s,0)
length(t,0)
}
}

Look forward to hearing from you.

thanks,

FZ

[0] Surround your code with "{ c o d e }" without the spaces.

[1] You should be getting DXL errors, since "target(link)" returns a ModName_ variable, not a Module variable. You can get the full name from the ModName_, then get a Module handle by 'read'ing it invisibly.

ModName_ targetMN = target lnk
string NameFull = fullName(targetMN)
Module targetMod = read(NameFull, false, true) // Open standard view

[2] I don't think the string version of hst.type "" is the same as "modifyObject". Don't use the quotes:

if (h.type == createObject) displayRich "{\\b Created on " h.date "}"
if (h.type == modifyObject && (etc...

[3] You want to SET the compare buffers to the values, not append. Get rid of the + signs:

t = (string h.plainOldValue)
s = (string h.plainNewValue)

[4] I have a nagging memory that the Buffer 'length' commands don't work. Just set them to null:

r = ""
s = ""
t = ""

[5] targetInitialName works in v9.2 I think. I think 'initial' means that's the name at the time of the History.

[6] You are opening target modules, but then not using the skprfix

  • Louie

Re: Link History Details
ibmmm - Tue Apr 05 09:42:44 EDT 2011

llandale - Tue Jan 19 17:23:24 EST 2010
[0] Surround your code with "{ c o d e }" without the spaces.

[1] You should be getting DXL errors, since "target(link)" returns a ModName_ variable, not a Module variable. You can get the full name from the ModName_, then get a Module handle by 'read'ing it invisibly.

ModName_ targetMN = target lnk
string NameFull = fullName(targetMN)
Module targetMod = read(NameFull, false, true) // Open standard view

[2] I don't think the string version of hst.type "" is the same as "modifyObject". Don't use the quotes:

if (h.type == createObject) displayRich "{\\b Created on " h.date "}"
if (h.type == modifyObject && (etc...

[3] You want to SET the compare buffers to the values, not append. Get rid of the + signs:

t = (string h.plainOldValue)
s = (string h.plainNewValue)

[4] I have a nagging memory that the Buffer 'length' commands don't work. Just set them to null:

r = ""
s = ""
t = ""

[5] targetInitialName works in v9.2 I think. I think 'initial' means that's the name at the time of the History.

[6] You are opening target modules, but then not using the skprfix

  • Louie

The following code lists the prefix for the object:
 

ModuleVersion targetMN = h.targetVersion
ModuleProperties mp
getProperties(targetMN, mp)
string pf = mp."Prefix"

 


Matthias

 

Re: Link History Details
HiLbiLy - Wed Sep 28 14:32:37 EDT 2011

ibmmm - Tue Apr 05 09:42:44 EDT 2011

The following code lists the prefix for the object:
 

ModuleVersion targetMN = h.targetVersion
ModuleProperties mp
getProperties(targetMN, mp)
string pf = mp."Prefix"

 


Matthias

 

You can get the name of the target Module by using the following:
History h
if(h.type "" == "createLink") {
ModuleVersion targetMN = h.targetVersion
print fullName(targetMN)
}