Topic
  • 8 replies
  • Latest Post - ‏2013-07-09T19:12:11Z by llandale
snc-engineer
snc-engineer
5 Posts

Pinned topic Remove Duplicate Items from Layout Wizard

‏2013-07-02T23:00:18Z |

Please help.  I am trying to modify the Wizard generated layout dxl columns to remove duplicate object identifiers from a second level linked module.  I have seen advice to use the skip list, I have not been able to figure out how to implement this idea from a prior post:

"You need a global Skip list with 'Object' as the key.  Done at the bottom where its DoneOne=true, you want to put othero into the Skip instead of displaying its information.  If the Object is already in the skip then the put is ignored.  After this code you need ot plow thorough the Skip list, getting othero values, and display them."

I am unsure how to fit this into the existing wizard code, nothing I try seems to work.

  • PRM
    PRM
    33 Posts

    Re: Remove Duplicate Items from Layout Wizard

    ‏2013-07-02T23:30:12Z  

    I'm more concerned about why you are seeing duplicate object identifiers, this should not typically happen when performing traceability.

    I am wondering if you have selected to use the Recursive Analysis option in the Analysis Wizard but you have a circular trace issue with the way in which links have been allowed to flow between modules.

    Duplicate object identifiers will appear if circular linking has occurred across modules. For example, if you have modules A and B.....and module A has links to module B, and module B has links back to module A.  A trace column created by the Analysis Wizard using the default multiple depth trace of 3 hops or more will cause DOORS to follow links from A to B, then from B back to A, then from A back to B  - as you can see, the trace from A to B has been done twice so duplicate object identifiers will start to be displayed.

    Paul Miller
    Melbourne, Australia

     

    Updated on 2013-07-02T23:30:42Z at 2013-07-02T23:30:42Z by PRM
  • Tony_Goodman
    Tony_Goodman
    271 Posts

    Re: Remove Duplicate Items from Layout Wizard

    ‏2013-07-03T13:20:41Z  

    The code should look something like the following. Make sure you declare the skiplist before the showIn() function.

     

     

    // add this line
    Skip otherObjects = create
     
    void showIn(Object o, int depth) {
     
    // blah blah
     
           if (depth == 1) {
                
      // add this line and move all display() calls to be within the skip list loop at the end
      put(otherObjects, othero, othero)
            }
        }
    }
    showIn(obj,1)
     
    // add the following lines
    Object o
    for o in otherObjects do
    {
    // paste display calls here
    display(identifier(othero))
    }

     

  • snc-engineer
    snc-engineer
    5 Posts

    Re: Remove Duplicate Items from Layout Wizard

    ‏2013-07-03T15:07:35Z  

    The code should look something like the following. Make sure you declare the skiplist before the showIn() function.

     

     

    // add this line
    Skip otherObjects = create
     
    void showIn(Object o, int depth) {
     
    // blah blah
     
           if (depth == 1) {
                
      // add this line and move all display() calls to be within the skip list loop at the end
      put(otherObjects, othero, othero)
            }
        }
    }
    showIn(obj,1)
     
    // add the following lines
    Object o
    for o in otherObjects do
    {
    // paste display calls here
    display(identifier(othero))
    }

     

    Thank you, I will try that.

  • snc-engineer
    snc-engineer
    5 Posts

    Re: Remove Duplicate Items from Layout Wizard

    ‏2013-07-03T15:11:13Z  
    • PRM
    • ‏2013-07-02T23:30:12Z

    I'm more concerned about why you are seeing duplicate object identifiers, this should not typically happen when performing traceability.

    I am wondering if you have selected to use the Recursive Analysis option in the Analysis Wizard but you have a circular trace issue with the way in which links have been allowed to flow between modules.

    Duplicate object identifiers will appear if circular linking has occurred across modules. For example, if you have modules A and B.....and module A has links to module B, and module B has links back to module A.  A trace column created by the Analysis Wizard using the default multiple depth trace of 3 hops or more will cause DOORS to follow links from A to B, then from B back to A, then from A back to B  - as you can see, the trace from A to B has been done twice so duplicate object identifiers will start to be displayed.

    Paul Miller
    Melbourne, Australia

     

    I agree this might be nontraditional for requirements, we are using this for verification efforts.  I attached our DOORS architecture for this, showing where the duplicates will arrive.  My goal is to ensure resources and data products are streamlined to remove duplicates. 

    Attachments

  • snc-engineer
    snc-engineer
    5 Posts

    Re: Remove Duplicate Items from Layout Wizard

    ‏2013-07-03T18:22:38Z  

    The code should look something like the following. Make sure you declare the skiplist before the showIn() function.

     

     

    // add this line
    Skip otherObjects = create
     
    void showIn(Object o, int depth) {
     
    // blah blah
     
           if (depth == 1) {
                
      // add this line and move all display() calls to be within the skip list loop at the end
      put(otherObjects, othero, othero)
            }
        }
    }
    showIn(obj,1)
     
    // add the following lines
    Object o
    for o in otherObjects do
    {
    // paste display calls here
    display(identifier(othero))
    }

     

    Unfortunately I received dxl errors, wondering if I applied your instructions wrong.  Here are the errors, below is the dxl I used (colored items I added from your instructions).

    Errors:

    E- DXL: <Line:77> incorrect arguments for function (identifier)
    -E- DXL: <Line:77> undeclared variable (othero)
    -E- DXL: <Line:77> undeclared variable (s)
    -E- DXL: <Line:78> incorrect arguments for (==)
    -E- DXL: <Line:78> incorrect arguments for (if)
    -E- DXL: <Line:81> incorrectly concatenated tokens
    -I- DXL: All done. Errors reported: 6. Warnings reported: 0.
     

    Code:

    // DXL generated by DOORS traceability wizard on 03 July 2013.
    // Wizard version 2.0, DOORS version 9.3.0.7
    pragma runLim, 0
    int lines[2] = {0, 0}
    void adjustLines(int depth, showAtDepth) {
        int count
        for (count = 0; count < 2; count++) {
            while (lines[depth-1] < lines[count]) {
                if (depth == showAtDepth) displayRich("\\pard " " ")
                lines[depth-1]++
            }
        }
    }
    // added this line for skiplist
    Skip otherObjects = create

    void showOut(Object o, int depth) {
        Link l
        LinkRef lr
        ModName_ otherMod = null
        Module linkMod = null
        ModuleVersion otherVersion = null
        Object othero
        string disp = null
        string s = null
        string plain, plainDisp
        int plainTextLen
        int count
        bool doneOne = false
        Item linkModItem = itemFromID("4dde9d736eea356e-00000163")
        if (null linkModItem) {
            displayRich("\\pard " "<<Link module not found>>")
        } else if (type(linkModItem) != "Link") {
            displayRich("\\pard " "<<Invalid link module index for this database>>")
        } else {
            string linkModName = fullName(linkModItem)
            for l in all(o->linkModName) do {
                otherVersion = targetVersion l
                otherMod = module(otherVersion)
                if (null otherMod || isDeleted otherMod) continue
                othero = target l
                if (null othero) {
                    load(otherVersion,false)
                }
                othero = target l
                if (null othero) continue
                if (isDeleted othero) continue
                int oldLines = lines[depth-1]
                adjustLines(depth, 2)
                bool kick = (doneOne) && (lines[depth-1] == oldLines)
                if (kick) {
                    lines[depth-1]++
                    if (depth == 2) displayRich("\\pard " " ")
                }
                if (depth < 2) {
                    showOut(othero, depth+1)
                }
                doneOne = true
                if (depth == 2) {
                // added this line for skiplist
                    put(otherObjects, othero, othero)
                    //s = (identifier othero)
                    //if (s == "")
                    //displayRich("\\pard " " ")
                    //else
                    //displayRich("\\pard " s)

                }
                lines[depth-1] += 1
            }
        }
    }
    showOut(obj,1)
    // add the following lines
    Object o
    for o in otherObjects do
    {
    // paste display calls here
                    s = (identifier othero)
                    if (s == "")
                    displayRich("\\pard " " ")
                    else
                    displayRich("\\pard " s)
    //display(identifier(othero))
    - [commented this out, was not working with this line either]
    }

  • llandale
    llandale
    3035 Posts

    Re: Remove Duplicate Items from Layout Wizard

    ‏2013-07-08T19:04:42Z  

    Unfortunately I received dxl errors, wondering if I applied your instructions wrong.  Here are the errors, below is the dxl I used (colored items I added from your instructions).

    Errors:

    E- DXL: <Line:77> incorrect arguments for function (identifier)
    -E- DXL: <Line:77> undeclared variable (othero)
    -E- DXL: <Line:77> undeclared variable (s)
    -E- DXL: <Line:78> incorrect arguments for (==)
    -E- DXL: <Line:78> incorrect arguments for (if)
    -E- DXL: <Line:81> incorrectly concatenated tokens
    -I- DXL: All done. Errors reported: 6. Warnings reported: 0.
     

    Code:

    // DXL generated by DOORS traceability wizard on 03 July 2013.
    // Wizard version 2.0, DOORS version 9.3.0.7
    pragma runLim, 0
    int lines[2] = {0, 0}
    void adjustLines(int depth, showAtDepth) {
        int count
        for (count = 0; count < 2; count++) {
            while (lines[depth-1] < lines[count]) {
                if (depth == showAtDepth) displayRich("\\pard " " ")
                lines[depth-1]++
            }
        }
    }
    // added this line for skiplist
    Skip otherObjects = create

    void showOut(Object o, int depth) {
        Link l
        LinkRef lr
        ModName_ otherMod = null
        Module linkMod = null
        ModuleVersion otherVersion = null
        Object othero
        string disp = null
        string s = null
        string plain, plainDisp
        int plainTextLen
        int count
        bool doneOne = false
        Item linkModItem = itemFromID("4dde9d736eea356e-00000163")
        if (null linkModItem) {
            displayRich("\\pard " "<<Link module not found>>")
        } else if (type(linkModItem) != "Link") {
            displayRich("\\pard " "<<Invalid link module index for this database>>")
        } else {
            string linkModName = fullName(linkModItem)
            for l in all(o->linkModName) do {
                otherVersion = targetVersion l
                otherMod = module(otherVersion)
                if (null otherMod || isDeleted otherMod) continue
                othero = target l
                if (null othero) {
                    load(otherVersion,false)
                }
                othero = target l
                if (null othero) continue
                if (isDeleted othero) continue
                int oldLines = lines[depth-1]
                adjustLines(depth, 2)
                bool kick = (doneOne) && (lines[depth-1] == oldLines)
                if (kick) {
                    lines[depth-1]++
                    if (depth == 2) displayRich("\\pard " " ")
                }
                if (depth < 2) {
                    showOut(othero, depth+1)
                }
                doneOne = true
                if (depth == 2) {
                // added this line for skiplist
                    put(otherObjects, othero, othero)
                    //s = (identifier othero)
                    //if (s == "")
                    //displayRich("\\pard " " ")
                    //else
                    //displayRich("\\pard " s)

                }
                lines[depth-1] += 1
            }
        }
    }
    showOut(obj,1)
    // add the following lines
    Object o
    for o in otherObjects do
    {
    // paste display calls here
                    s = (identifier othero)
                    if (s == "")
                    displayRich("\\pard " " ")
                    else
                    displayRich("\\pard " s)
    //display(identifier(othero))
    - [commented this out, was not working with this line either]
    }

    I see that "s" and "othero" are correctly defined in function "showOut", lines #24 and #22.    I see starting at line #73 you have code not in any function and specifically not in function "showOut".  You can fix:

    • Add "string s" after line #73.
    • Change "othero" to "o" at line #77.
    • Lets be neat and do this at the end:  delete(otherObjects).  Doesn't matter here (at very end of script) but it does matter when used in a function and is a good habit to get into.

    -Louie

  • snc-engineer
    snc-engineer
    5 Posts

    Re: Remove Duplicate Items from Layout Wizard

    ‏2013-07-09T13:48:35Z  
    • llandale
    • ‏2013-07-08T19:04:42Z

    I see that "s" and "othero" are correctly defined in function "showOut", lines #24 and #22.    I see starting at line #73 you have code not in any function and specifically not in function "showOut".  You can fix:

    • Add "string s" after line #73.
    • Change "othero" to "o" at line #77.
    • Lets be neat and do this at the end:  delete(otherObjects).  Doesn't matter here (at very end of script) but it does matter when used in a function and is a good habit to get into.

    -Louie

    @llandale (Louie) - Thank you for the suggestion, I did try your recommendation.  Result is that there are no errors, however no items show up in the layout dxl column either. 

    Unsure how to make this work without a blank column or a syntax error.

  • llandale
    llandale
    3035 Posts

    Re: Remove Duplicate Items from Layout Wizard

    ‏2013-07-09T19:12:11Z  

    @llandale (Louie) - Thank you for the suggestion, I did try your recommendation.  Result is that there are no errors, however no items show up in the layout dxl column either. 

    Unsure how to make this work without a blank column or a syntax error.

    Lets say your links look like this:

    • oA1 in mA links to oB1 in mB through your link module
    • oA1 in mA links to oB2 in mB through your link module
    • oB1 in mB links to oC1 in mC through the same link module.
    • oB2 in mB links to oC1 in mC through the same link module
    • You are deploying the code in mA intending to see objects in mC two links away.

    Notice there are two paths from oA1 to oC1.  The code is intended to insure that information about oC1 only displays once for oA; where the original Wizard code will display it twice.

    I think the code works in that case.  I wonder however if your B->C links are in the same link-module as your A->B links.

    -Louie