![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Is module handle the same as a module? Topic Summary: setting current to current module Created On: 4-Aug-2005 13:58 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() Answer: Tony, Thanxs! :-). I found out that my error was when I was passing my array. You can't pass the an array with un-initialize values to the create function when trying ot create a attribute type. e.g. string attrVal[3] attrVal[0] = "Low" attrVal[1] = "High" string mess = "" attrType at = create("LowHighList", attrVal, mess) will crash and give you an access violation error. It is obvious that the create function will try to access the unitialized values of the array. Thanks for the comments. It helped me find my solution. Leidy Ramirez | |
![]() |
|
Item it |
|
![]() |
|
![]() |
|
Use the following to set the curent Module:
(current ModuleRef__) = mod You do not need to (and can't) cast "mod". e.g: Item it Module mod for it in current Folder do { mod = edit(fullName(it), false) (current ModuleRef__) = mod print("Current Module = " name(current Module) "\n") close(mod) } The function "current" is overloaded for different types, so you need to make the item type explicit unless you are assigning to a variable. e.g. print("Current Folder = " name(current Folder) "\n") print("Current Module = " name(current Module) "\n") ------------------------- Tony Goodman http://www.smartdxl.com |
|
![]() |
|
![]() |
|
What exactly is moduleName set to? I assume you'd want to set it to the fullName of the item you're currently on:
Item it string moduleName = "" for it in current Folder do { moduleName = fullName(it) print moduleName "\n" Module mod = edit(moduleName, false) current = mod print "Current: " name (current Module) "\n" } Then I think you have to specifically tell it to use the (current Module). If you just say current it seems to assume current Folder. Hope this helps! Edit: Looks like Tony beat me to it! He can explain a lot better than I can too. Edited: 4-Aug-2005 at 16:39 by Chris Jones |
|
![]() |
|
![]() |
|
Tony and Chris,
If I pritn the current module, I get the current module. If I print current I get the parent folder. I tried also putting all the "formal" modules in skiplist and then iterating to the list but still when I print current inside the module skiplist I still get the parent folder. I am tryign to create a attribute definition and I keep getting a ACCESS_VIOLATION_ERROR when I call the create function and I am pretty sure that it is because of "current". Here is the code that I have now: string sAttrName = "" string sAttrType = "" string sAttrDefault = "" string sAttrValue = "" string sAttrValueList[50] int count = 0 Item itm Item it sAttrValueList[0] = "low" sAttrValueList[1] = "medium" sAttrValueList[2] = "high" current = current Project for itm in current Project do { string tpy = type(itm) if(tpy == "Folder" and (name itm) == "01 Customer Specs") { Folder fld = folder(itm) current = fld print "CURRENT0: " name current "\n" Skip listOfModules = create Module modu for it in fld do { tpy = type(it) print "inside folder" "\n" if(tpy == "Formal") { read(fullName(it), false) Module m = module(it) print "it's a formal module" "\n" if(!null m) put(listOfModules, m, m) else print "null mod" "\n" }//if(tpy == "Formal") } //for it in current Folder do Module mod print "completed list" sizeof(listOfModules) "\n" for mod in listOfModules do { edit(fullName(mod), false) print "MODULE: " name mod "\n" current ModuleRef__ = mod print "CURRENT1: " name (current Module) "\n" print "creating attribute for " name current " module " "\n" AttrType at = create (sAttrName, sAttrValueList, mess) if(null at || !null mess) { print "failed to create attribute. error: " mess "\n" } } } } Thanks in advance for your comments and suggestions. Leidy Ramirez |
|
![]() |
|
![]() |
|
The attached does the job.
You will need to add more error checking etc. You first loop "for item in project" recurses through sub-folders, which is unnecessary if you are only interested in the Customer Specs folder, so I replaced the loop with a test for the existence of the folder in the project. Then I get a handle on the Customer Specs folder using the folder() function. The "for item in folder" loop does not recurse and suits our purpose for getting modules in that folder. The current module is set correctly when you open a module for edit. Remember to save and close the module afterwards. ------------------------- Tony Goodman http://www.smartdxl.com |
|
![]() |
|
![]() |
|
Tony,
Thanxs! :-). I found out that my error was when I was passing my array. You can't pass the an array with un-initialize values to the create function when trying ot create a attribute type. e.g.
string attrVal[3]
attrVal[0] = "Low"
attrVal[1] = "High"
string mess = ""
attrType at = create("LowHighList", attrVal, mess) will crash and give you an access violation error.
It is obvious that the create function will try to access the unitialized values of the array.
Thanks for the comments. It helped me find my solution.
Leidy Ramirez
|
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Is module handle the same as a module?
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.