Engineering

 View Only
Expand all | Collapse all

DXL Script to Follow In Links with additional parameter of "Program Allocation"

  • 1.  DXL Script to Follow In Links with additional parameter of "Program Allocation"

    Posted Tue September 21, 2021 12:57 PM
    I am new to DXL and hoping for assistance.  I found a DXL attribute script on the SMART DXL site that will return the Object Identifier (or other attribute if specified) by following the in-link of a specified Link Module.  However, in addition to the Link Module, I also need to specify the value of an attribute (Program Allocation) and only return the values for the in-links that match both the Link Module Name and the Program Allocation value.  Any assistance would be greatly appreciated.

    Following is the DXL code that I was able to find on the SMART DXL site here  Attribute DXL to Display Incoming Traces


    // Satisfied By

    /*
    Display child requirements that are linked to the current requirement via "satisfies" links.

    Tony Goodman

    */

    pragma runLim, 0

    Buffer bsz = create

    Link l = null
    LinkRef lr = null
    ModName_ otherMod = null
    Object othero = null
    bool doneOne = false

    string LM = "satisfies"

    for lr in all(obj<-"*") do
    {
    if (name(module lr) != LM) continue

    ModuleVersion mvSource = sourceVersion(lr)

    otherMod = module(mvSource)

    if (!null otherMod)
    {
    if ((!isDeleted otherMod) && (null data(mvSource)))
    {
    load((mvSource), false)
    }
    }

    delete(mvSource)
    }

    for l in all(obj<-"*") do
    {
    if (name(module l) != LM) continue

    ModuleVersion otherVersion = sourceVersion(l)

    otherMod = module(otherVersion)

    if (null otherMod || isDeleted otherMod) continue

    othero = source(l)

    if (null othero)
    {
    load(otherVersion, false)
    }

    othero = source(l)

    if (null othero) continue
    if (isDeleted othero) continue

    if (doneOne)
    {
    bsz += "\n"
    }

    bsz += identifier(othero)

    // to display a different attribute, un-comment the following line and replace <attr-name> with your attribute name.
    //bsz += probeAttr_(othero, "<attr-name>")

    doneOne = true

    delete(otherVersion)
    }

    obj.attrDXLName = tempStringOf(bsz)

    delete(bsz)

    ------------------------------
    Douglas Christian
    ------------------------------

    #Sustainability
    #Engineering


  • 2.  RE: DXL Script to Follow In Links with additional parameter of "Program Allocation"
    Best Answer

    Posted Wed September 22, 2021 04:01 AM

    You can try something like

    if (probeAttr_(othero, "Program Allocation") != "specific value") continue

    line 62 ... 

    Enjoy !



    ------------------------------
    steeve rodriguez
    ------------------------------



  • 3.  RE: DXL Script to Follow In Links with additional parameter of "Program Allocation"

    Posted Tue January 18, 2022 02:40 PM
    Towards the end of your code you have 'delete(otherVersion)'. What are you intending to do with this?

    'otherVersion' is a handle on the other Module Version at the other end of the link.

    ------------------------------
    Martyn Brett
    ------------------------------