adding attributes to a module

Hi,
I have a little problem with DXL. I made a script which basically creates a new module and copies some objects of the current module into this new one.

What I need to do now is creating some attributes in the new module (called new_mod).
The expression to create attributes seems to create attributes in the current module..see below :

create module type "String" attribute "Requirement ID"

'module' is not a variable name so cannot be changed..it seems to refer to the current module..
Does anyone know how to create a new attribute and place it in a previously created module called 'new_mod' ?

Thanks a million !
SystemAdmin - Wed Sep 23 11:54:14 EDT 2009

Re: adding attributes to a module
llandale - Wed Sep 23 15:06:31 EDT 2009

All of these commands that presume 'current Module' should be preceded with a setting of current. I think such commands should be followed by resetting the current module

Might look something like this:


// Global Parameters  Module mSource = current 
// Run script from this source module Module mNew = 

null   create the 

new module, set mNew   current = mNew create(module type 
"String" attribute 
"Requirement ID") create(some more attributes) current = mCurr  
// Reset current module back to original   It may perhaps also look like 

this: Module mCurr = current current = mNew create(bla bla bla) 

if (!

null mCurr) current = mCurr


Just about all my 300 or so DXL have this line of code: Module g_mCurr = current. For scripts that must run from an open module, I display and error and halt when g_mCurr is null. For scripts that must not run from an open module, I display an error and halt when g_mCurr is not null. In any case, I always know them original current module. Perhaps that variable should be g_mOriginal, but I'm too used to g_mCurr.

  • Louie

Re: adding attributes to a module
SystemAdmin - Thu Sep 24 05:27:55 EDT 2009

I believe what you are asking is about the "module" in:

AttrDef create([module|object] [property value]... [(

default defVal)] attribute(string attrName))

The create function will always create the new attribute definition in the current module, the [module|object] is a flag for whether the attribute is a module attribute or an object attribute.

Or did I misunderstand your question?

/Kristian