Question

I have written a DXL functions which reads out some attributes and outgoing links from a DOORS module and writes it to an MS Excel Sheet. It works fine.

Now i would like to add the following to the DXL-function:

When I open a DOORS module and apply a Filter --> "Links" then i can say "passes Linkmodule" and choose a specific one. (I have the german DOORS versions so maybe it's called a bit different)

This is the functions that i have at the moment:

void WriteAllOutLinksToExcel (string sModuleName, string sBookName, string sSheetName)
{
    OleAutoObj  objExcel = oleGetAutoObject("Excel.Application")
    OleAutoObj  objBook
    OleAutoObj  objSheet = null
    OleAutoArgs oleArgs = create
    Object  oCur
    Module  mCur
    bool        excelVisible 
    string  sTemp = ""
    string  sResult = ""
    string  sNum
    int         iRow = 1
    int     iCount = 0
    int         iNum
    Link        lref
    ModName_    targetMod

    oleGet(objExcel, "Visible", excelVisible);
    if (!excelVisible) olePut(objExcel,"visible",true);

    sResult = oleGet(objExcel,"Workbooks", sBookName);

    clear oleArgs;
    put(oleArgs, sSheetName);
    sResult = oleGet(objExcel, "Sheets", oleArgs, objSheet);

    mCur = edit(sModuleName,false);
    if(mCur != null)
    {
        View v = view("_ABC");
        for oCur in mCur do
        {
            // Absolute object no..
            sTemp = oCur."Absolute Number";
            objCell = ExcelGetCell(objSheet, iRow, 1);
            olePut(objCell,"Value",sTemp);          

            // Object text
            sTemp = oCur."Object text";
            objCell = ExcelGetCell(objSheet, iRow, 2);
            olePut(objCell,"Value",sTemp);          

            // Links
            iCount = null;
            for lref in oCur -> "*" do {    
                targetMod = target lref;
                iNum = targetAbsNo(lref);
                sNum = " " iNum " ";
                if(iCount == 0)
                {
                    sTemp = fullName(targetMod) sNum;
                }
                else
                {
                    sTemp = sTemp "\n" fullName(targetMod);
                    sTemp = sTemp sNum;
                }
                objCell = ExcelGetCell(objSheet, iRow, 3);
                olePut(objCell,"Value",sTemp);
                iCount ++;
            }           
            iRow ++;
        }
    }
    close(mCur);
    oleCloseAutoObject (objExcel);
}

I am thinking of something like an if-statement inside the for-loop which says: "If linkmodule "abc" is passed then list the information "Object number" & "Object text" & links...

Is this possible? Hope someone can help me with this one?

Was it helpful?

Solution

All you should need to do is add the parameter to your inputs (I added string LinkModName here) then instead of "*" put LinkModName. The "*" is saying all link modules, but you can replace that with the string name of any specific link module you want to use. Also you should make sure to pass the full path of the Link Module to the function.

Like: /Project_Name/Folder_Name/Link_Module_Name

void WriteAllOutLinksToExcel (string sModuleName, string sBookName, string sSheetName, string LinkModName)
{
  OleAutoObj  objExcel = oleGetAutoObject("Excel.Application")
  OleAutoObj  objBook
  OleAutoObj  objSheet = null
  OleAutoArgs oleArgs = create
  Object  oCur
  Module  mCur
  bool        excelVisible 
  string  sTemp = ""
  string  sResult = ""
  string  sNum
  int         iRow = 1
  int     iCount = 0
  int         iNum
  Link        lref
  ModName_    targetMod

  oleGet(objExcel, "Visible", excelVisible);
  if (!excelVisible) olePut(objExcel,"visible",true);

  sResult = oleGet(objExcel,"Workbooks", sBookName);

  clear oleArgs;
  put(oleArgs, sSheetName);
  sResult = oleGet(objExcel, "Sheets", oleArgs, objSheet);

  mCur = edit(sModuleName,false);
  if(mCur != null)
  {
     View v = view("_ABC");
     for oCur in mCur do
     {
        // Absolute object no..
        sTemp = oCur."Absolute Number";
        objCell = ExcelGetCell(objSheet, iRow, 1);
        olePut(objCell,"Value",sTemp);          

        // Object text
        sTemp = oCur."Object text";
        objCell = ExcelGetCell(objSheet, iRow, 2);
        olePut(objCell,"Value",sTemp);          

        // Links
        iCount = null;
        for lref in oCur -> LinkModName do {    
            targetMod = target lref;
            iNum = targetAbsNo(lref);
            sNum = " " iNum " ";
            if(iCount == 0)
            {
                sTemp = fullName(targetMod) sNum;
            }
            else
            {
                sTemp = sTemp "\n" fullName(targetMod);
                sTemp = sTemp sNum;
            }
            objCell = ExcelGetCell(objSheet, iRow, 3);
            olePut(objCell,"Value",sTemp);
            iCount ++;
        }           
        iRow ++;
    }
  }
  close(mCur);
  oleCloseAutoObject (objExcel);
}

Hope this helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top