Topic
  • 4 replies
  • Latest Post - ‏2014-03-13T20:44:38Z by llandale
Wicker
Wicker
3 Posts

Pinned topic Accessing link target object, null Object parameter

‏2014-03-12T20:23:43Z |

I am working to reverse the links in all modules in a project. I have been able to get my code to work on a test set of modules. When I move to a restored copy of the actual project I am getting an error null Object Parameter was passed ... below is the void were the error occurs. The DXL halts on the oTarget ->lm -> oSrource line.

After some output debugging I discovered that the oTarget is null, oSource is fine.  Any ideas?

void linkFlip(Skip linkList){
  Link l
  print "Reversing Links\n"
  Object oSource, oTarget
  Module mSource, mTarget, mLink
  ModName_ mnSource, mnTarget
  string sLinkMod
  for l in linkList do {
    mSource = module(source(l))
    mTarget = module(target(l))
    mnSource = module(source(l))
    mnTarget = module(target(l))
    if (!isEdit(mSource)) mSource=edit(fullName(mnSource),false) 
    if (!isEdit(mTarget)) mTarget=edit(fullName(mnTarget),false)  
    mLink = edit(fullName(module(l)), false) 
    oTarget = object(targetAbsNo(l), mTarget)
    oSource = object(sourceAbsNo(l), mSource)
    sLinkMod = fullName(module(l))
    oTarget -> sLinkMod -> oSource
    print " " sLinkMod "|" source l "|" sourceAbsNo l"|->|" target l "|" targetAbsNo l "|REVERSED"
    if(canDelete(l)){
      delete l
      print"|DELETED\n"
    } else {
      print "|FAILED\n"
    }
    rev++
    flushDeletions
  }
}



}



 

 

Updated on 2014-03-13T16:08:57Z at 2014-03-13T16:08:57Z by Wicker
  • 7XUT_Antonio_Norkus
    7XUT_Antonio_Norkus
    18 Posts
    ACCEPTED ANSWER

    Re: Accessing link target object, null Object parameter

    ‏2014-03-13T15:25:09Z  

    the function object(int absNum, Module m) works on the current displayed objects.

    If your default view for a module has a filter, then it is possible for it to return null for objects that are not displayed.

    After opening a module, perform:

    filtering off

    showDeletedObjects on

    This will ensure that all objects are displayed, so that object(int absNum, Module m) won't return nulls (unless absNum really doesn't exist in the module)

  • Wicker
    Wicker
    3 Posts

    Re: Accessing link target object, null Object parameter

    ‏2014-03-12T20:27:14Z  

    ok, after reading that post I realized how bad the variable names to and so were, they have been changed to oTarget and oSource. Sadly, but not surprisingly, that did not solve the issue.

  • 7XUT_Antonio_Norkus
    7XUT_Antonio_Norkus
    18 Posts

    Re: Accessing link target object, null Object parameter

    ‏2014-03-13T15:25:09Z  

    the function object(int absNum, Module m) works on the current displayed objects.

    If your default view for a module has a filter, then it is possible for it to return null for objects that are not displayed.

    After opening a module, perform:

    filtering off

    showDeletedObjects on

    This will ensure that all objects are displayed, so that object(int absNum, Module m) won't return nulls (unless absNum really doesn't exist in the module)

  • Wicker
    Wicker
    3 Posts

    Re: Accessing link target object, null Object parameter

    ‏2014-03-13T16:08:04Z  

    the function object(int absNum, Module m) works on the current displayed objects.

    If your default view for a module has a filter, then it is possible for it to return null for objects that are not displayed.

    After opening a module, perform:

    filtering off

    showDeletedObjects on

    This will ensure that all objects are displayed, so that object(int absNum, Module m) won't return nulls (unless absNum really doesn't exist in the module)

    Wow, that was exactly the problem. I would have never thought of filtering. Many thanks!

  • llandale
    llandale
    3035 Posts

    Re: Accessing link target object, null Object parameter

    ‏2014-03-13T20:44:38Z  

    the function object(int absNum, Module m) works on the current displayed objects.

    If your default view for a module has a filter, then it is possible for it to return null for objects that are not displayed.

    After opening a module, perform:

    filtering off

    showDeletedObjects on

    This will ensure that all objects are displayed, so that object(int absNum, Module m) won't return nulls (unless absNum really doesn't exist in the module)

    Actually:

     filtering    off
     graphics     off
     outlining    off
     showPictures on
     showTables   on
     sorting      off
     showDeletedObjects(true)
     level(0)