How to find Project\ Project Name of the current Module?

I want the Project\ Project name of the current module.
The module running the dxl is not same as the current opened module. I tried the below code but did not work.

Module m = edit (s)
oldCurr = current Module
current = m
targetProject = current Project
if(!null targetProject)
{
print (name targetProject) "\n"
}
else
{
ack "The target module is not inside the project"
}
current = oldCurr

current Project is still referring to the project containing the module running Dxl
DXLScripter - Tue Sep 11 11:56:09 EDT 2012

Re: How to find Project\ Project Name of the current Module?
SystemAdmin - Tue Sep 11 12:19:16 EDT 2012

getParentFolder (item)

Declaration
Folder getParentFolder({Item i|Folder f|Project p|Module m|ModName_ modRef})

Operation
Returns the folder containing the item specified by the argument. If the argument is the root folder, returns null.
  • Pekka Mäkinen - http://www.softqa.eu/

Re: How to find Project\ Project Name of the current Module?
llandale - Tue Sep 11 17:09:14 EDT 2012

Perhaps this is useful:
  • Module m1, m1
  • Project p1, p2
  • m1 = current()
  • p1 = getParentProject(m1)
  • m2 = read(some module)
  • p2 = getParentProject(m2)
  • if (p1 != p2) then modules in different projects

I think you have a "current" problem and should get your handles some other way; certainly swap your first two lines
  • oldCurr = current Module
  • Module m = edit (s)

If your code is intended to have a module as it's scope; run from a module not from the Explorer; then a line like this at the top should be ROUTINE; before you do anything else.
  • Module mOriginal = current().
if this is a layout of attrDXL, then perhaps this:
  • Module mOriginal = module(obj)
After that, you don't need the "current()" function and will save yourself the pitfalls of "current".

-Louie

Re: How to find Project\ Project Name of the current Module?
DXLScripter - Wed Sep 12 02:05:47 EDT 2012

Thank you so much for the quick response.