![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: How to quickly delete incoming link? Topic Summary: Created On: 16-Sep-2002 18:17 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Hi there,
Does anyone know how to quickly delelte incoming links? The incoming links might come from different modules. Thanks a lot for your help! hong |
|
![]() |
|
![]() |
|
You'll need to give more information, but you need to have the source module ..err.. source object open for edit. In DXL, once you figure out the name of the source module open it edit exclusive, then delete the link handle.
- Louie |
|
![]() |
|
![]() |
|
Hi Louie,
Thanks a lot first for your quick response. The background for this code is that we just purchased DOORS license and TestDirector license in order to standize our buisness process. Telelogic provide a DXL that can extract test cases that developed in TestDirector into a DOORS formal module called *- Test Plan. However, this DXL code has a big drawback. If we deleted a test case in TestDirector, it is totally gone from TestDirector SQL database. But in the DOORS module, it is still there only change the DCTD Change Status from Add to Deleted. If we have thousands of test case and later on delete part of them frenquently, we will have a very huge formal module in DOORS. We thought it might be not too difficulty to write a DXL script by ourself to simply delete those deleted test cases. I don't know whether you use this TestDirector thing too or not. I hope that I explain this clearly. I am new to DXL script. That is why I can't handle this problem well I think. Here is my code. The first For loop that deletes outlinks works fine. The second For loop definitely not work. But once I run the script, I got the error message saying that "-R-E- DXL: <Line:33> cannot delete Object: object has incoming links". But when I went back to the original module, the incoming link was actually deleted, just leave the object undeleted. //**********************Code************************ Module m = current Object o = first m for o in entire m do { string s = o."DCTD Change Status" string ss = "Deleted" if (cistrcmp(s,ss) == 0) then { Link outLink, inLink for outLink in o -> "*" do { delete (outLink) } for inLink in o <- "*" do { Object targetObj = target inLink delete (inLink) } softDelete o } } thanks a lot again, hong |
|
![]() |
|
![]() |
|
Hong,
I added a line to your code which I believe should help the problem. Hopefully it works... ------------------------- rg. ![]() |
|
![]() |
|
![]() |
|
Hi rq,
Thanks first. I added the line to the original code. Then I ran the code (for the first time). I got the following error message: -R-E- DXL: <Line:33> cannot delete Object: object has incoming links -I- DXL: <Line:42> execution halted But the incoming link was actully deleted. Then I ran the code for the second time, the object got deleted. My question here: How can I delete it at one time? I also did the following: I set two objects at the same level, both have incoming link from exactly the same object (another object). Then I ran the code. First time, the first object got incoming link deleted and I got the above error message. The second time of running the code, the first object got deleted, the second object got incoming link deleted, and I got the above error message. The third time of running the code, I got the following error: -R-E- DXL: <Line:33> cannot delete Object: no access to source object -I- DXL: <Line:42> execution halted You mentioned in your note "This may cause an error since its dependant on the object assigned in the for loop". What do you mean by this? Also, I have the administrator's right. I should be able to do anything. Do you have any idea of what's going on here? thanks again, hong |
|
![]() |
|
![]() |
|
Hong,
I am suspecting that it has to do with the declarations of the variables being inside the loops we are using. (Someone correct me if I'm wrong here) There is an inheritance problem with declaring variables nested inside certain loop and if structures that fail to exist outside of their calls. One basic solution to this is to declare the variable globally before the function call and keep track of each time its written and make sure to clear it out before the next time it loops again to prevent data corruption. On the dark side of things, this means the dynamic ability of DXL is creating a new entry every time a variable is cast (i.e. strings). For the time being, lets try declaring the variables outside of the for structures... and making sure we clean up after each pass through. As to why it gave an error but actually deleted the link, that I have not given the most attention towards. ------------------------- rg. ![]() |
|
![]() |
|
![]() |
|
1) You cannot delete links within the "for link" loop since the loop requires the existence of the links. Rather create a skip list, add the links to be deleted to it, and after the loop delete all the links in the skip list.
2) Likewise (I believe) you should not delete objects within the "for obj" loop; add them to a skip list and delete them afterwards. 3) You will need to open the source module of the link for incoming links before you will see any of the links. I didn't compile the following code, but it should work in principle (I couldn't get it to attach, so sorry for the indentation problem): Skip DelObjSkip = create() Skip DelLinkSkip ModName_ ModRef Object obj Module mod = ??? Link link for obj in mod do { if (I want to delete this object) { DelLinkSkip = create() // Allocate Skip list // Mark all outlinks for deletion: for link in obj -> "*" do { put (DelLinkSkip, link, link) } // open sources of links: for ModRef in obj <- "*" do { ModName = fullName(ModRef) edit(ModName, false) } // Mark all inlinks for deletion for link in obj <- "*" do { put (DelLinkSkip, link, link) } // Delete links marked for deletion: for link in DelLinkSkip do delete(link) delete(DelLinkSlip) flushDeletions() // Mark object for deletion put (DelObjSkip, obj, obj) } // end obj to delete } // end for all objects // Delete objects marked for deletion: for obj in DelObjSkip do softDelete(obj) // or hardDelete flushDeletions() delete DelObjSkip - Louie |
|
![]() |
|
![]() |
|
Thanks a lot rq and Louie!!!
Let me try the code. thanks again, hong |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
How to quickly delete incoming link?
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.