Hi, all
In my project, there are two formal modules, which were named "ModuleA", "ModuleB" and a link module named "masterLink". The masterLink saves linksets between ModuleA and ModuleB.
My requirements are:
*1.*To each object in ModuleA, get all "out-going" link's history record and display it in a layout dxl column in ModuleA.
*2.*When I modify the link relations in masterLink, the history record *will not disappear*(eg. delete a link between object in ModuleA and object in ModuleB)
*3.*Display the link target name
I'm using codes as follows:
Link lnk
Object o
for lnk in obj-> "masterLink" do{
string user = lnk."Created By"
string tm = lnk."Created On"
if(user != null){
o = target lnk
string tarName = o."Object Text" //target name
display user "\t" tm
display tarName
}
}
These codes can meets my first requirement, however, how to modify these codes to let them meet my second requirement?
What I described above is using links function. There maybe another way, which I tried, is turn to object's history for help.
In a object's properties page,click "History". When I change the relations in masterLink, there will be a record created here. When I click a record, below it will display the "Details of selected history record", where saved the important information for me to get the target name, unfortunatelly, I didn't found any functions in dxl's help file to get it. I want to know if it can be realized?
Looking for your help with many thanks!
Sincerely, Aven
Aven_HIT - Tue Jan 05 20:32:37 EST 2010 |
Re: How to get object's link record and save it llandale - Wed Jan 06 11:03:08 EST 2010
I think you are asking for a layout that displays info about current links, as well as info about links that no longer exist.
Overall, you would plow through existing links (as you have done) and display them, but also save the target object in a Skip list. You would then plow through History looking for a createLink history to an object that's not already saved in the Skip. When found, use the history to get the Created By/On, find the object in the Target module to get that object's Text. Digressing: its tricky dealing with History, but I'd then find the corresponding deleteLink history and display the 'Deleted By/On' dates.
This presumes the Link was created and deleted within the latest baseline. If you want to display older links that have been recently deleted, you'd need to open up old baselines to get the created by/on and target object.
With a clever little program I can see which History parameters apply to which History Types. I see that parameters 'targetAbsNo' and 'sourceAbsNo' apply to types 'createLink' and 'deleteLink'; where 'sourceAbsNo' is the same as 'absNo', the object to which the History applies. I see that if you are the Administrator, you can also get parameters 'linkInitialName' and 'targetInitialName', the full path name of the Link module and Target Module at the time the link was created. The 'source module' is the current module which is not stored in History. Its odd that normal users cannot see these two parameters.
HistoryType ht = hst.type
if (ht == createLink or
ht == deleteLink)
{ SourceAbsNo = hst.sourceAbsNo
TargetAbsNo = hst.targetAbsNo
...
}
else {} // ignore this History
So it appears your layout (for normal folks) can deduce the target object AbsNo from History, but cannot deduce in which link module nor which target module the link applies.
When accessing History Parameters, its wise to: set the variable to null; noError(); retrieve; lastError. This is because if you retrieve a parameter for a History to which it doesn't apply, you get DXL errors.
Result = ""
noError()
Result = hst.<parameter>
lastError
|
Re: How to get object's link record and save it Aven_HIT - Sat Jan 09 03:47:31 EST 2010 llandale - Wed Jan 06 11:03:08 EST 2010
I think you are asking for a layout that displays info about current links, as well as info about links that no longer exist.
Overall, you would plow through existing links (as you have done) and display them, but also save the target object in a Skip list. You would then plow through History looking for a createLink history to an object that's not already saved in the Skip. When found, use the history to get the Created By/On, find the object in the Target module to get that object's Text. Digressing: its tricky dealing with History, but I'd then find the corresponding deleteLink history and display the 'Deleted By/On' dates.
This presumes the Link was created and deleted within the latest baseline. If you want to display older links that have been recently deleted, you'd need to open up old baselines to get the created by/on and target object.
With a clever little program I can see which History parameters apply to which History Types. I see that parameters 'targetAbsNo' and 'sourceAbsNo' apply to types 'createLink' and 'deleteLink'; where 'sourceAbsNo' is the same as 'absNo', the object to which the History applies. I see that if you are the Administrator, you can also get parameters 'linkInitialName' and 'targetInitialName', the full path name of the Link module and Target Module at the time the link was created. The 'source module' is the current module which is not stored in History. Its odd that normal users cannot see these two parameters.
HistoryType ht = hst.type
if (ht == createLink or
ht == deleteLink)
{ SourceAbsNo = hst.sourceAbsNo
TargetAbsNo = hst.targetAbsNo
...
}
else {} // ignore this History
So it appears your layout (for normal folks) can deduce the target object AbsNo from History, but cannot deduce in which link module nor which target module the link applies.
When accessing History Parameters, its wise to: set the variable to null; noError(); retrieve; lastError. This is because if you retrieve a parameter for a History to which it doesn't apply, you get DXL errors.
Result = ""
noError()
Result = hst.<parameter>
lastError
Hey, llandale
Thanks for your advice, I make it up successfully, many thanks!
Best regards, Aven
|