![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: views do not get loaded in a loop at project level !! Topic Summary: Created On: 24-Feb-2004 16:30 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() Answer: Thanks to Doug and Louie for your answers. I guess I need to make the module visible as you guys say which I didnt wanted to do initially. Thanks for pointing it out for me. | |
![]() |
|
I am trying to manipulate Layout DXL for columns in views. I am loading views in a loop from a project/folder level. My problem is the views are not getting loaded when I run my DXL code from a project/Folder level. If I take the same code and run it from an open module, it seems to run. Here is my code. Please scroll down to see the code I have problem with. Your help is appreciated.
void routine2(string path, string colname, string newproj, Stream stream1) { string newpath int k = 0, indicat1 = 0, indicat2 = 0 for (i=0;i<length(path);i++ ) { k = i + 4 if (path[i:k] == "/2.0/") { indicat1 = i + 4 for (j= i + 5;j<length(path);j++) { if (path[j:j] == "/") { indicat2 = j break } } //for break } } // for if ((indicat1 > 0) and (indicat2 > 0)) { newpath = path[0:indicat1] newproj path[indicat2-1:length(path)] stream1 << " New Layout DXL:" newpath "\n" } //dxl(colname, newpath) } void routine1(string path, string atname, string attype, string newproj, Stream stream1) { string newpath int k = 0, indicat1 = 0, indicat2 = 0 for (i=0;i<length(path);i++ ) { k = i + 4 if (path[i:k] == "/2.0/") { indicat1 = i + 4 for (j= i + 5;j<length(path);j++) { if (path[j:j] == "/") { indicat2 = j break } } //for break } } // for if ((indicat1 > 0) and (indicat2 > 0)) { newpath = path[0:indicat1] newproj path[indicat2-1:length(path)] stream1 << " New Attribute DXL : " newpath "\n" } //delete(atname) //AttrDef ad = create object type attype attribute atname newpath } if (null current Project) { ack "Please select a project to use this option." halt } else { Item itm1, itm2 string dxlVal, adname, adtype, viewName, att, titlec string newproj = "Testingproj" /* Enter the new project info here */ AttrDef ad Folder f1 = current Folder f2 Column c Project p = current Stream stream1 = write "C:\\DOORSOUTPUT/text1.txt" stream1 << "Project Name: " name(p) "\n" for itm1 in f1 do { if (type(itm1) == "Folder") { stream1 << " Folder Name : " name(itm1) "\n" current = folder fullName(itm1) f2 = current for itm2 in f2 do { if (type(itm2) == "Formal") { stream1 << " Module Name: " name(itm2) "\n" stream1 << " -----------" "\n" m = edit(fullName(itm2), false) m = current for ad in m do { if (ad.dxl) { dxlVal = ad.dxl adname = ad.name adtype = ad.typeName stream1 << " Attribute Name : " ad.name "\n" stream1 << " Old Attribute DXL : " dxlVal "\n" routine1(dxlVal, adname, adtype, newproj, stream1) } } for viewName in views m do { stream1 << " View Name: " viewName "\n" stream1 << " ---------" "\n" load view(viewName) // ---------------------------------------------> Views are not get loaded when // ---------------------------------------------> this code is run at a project / // ---------------------------------------------> folder level. for c in m do { att = attrName(c) if (null att) { if (!main(c)) { stream1 << " Column Name: " title c "\n" stream1 << " Old Layout DXL:" dxl(c) "\n" titlec = title c dxlVal = dxl(c) routine2(dxlVal, titlec, newproj, stream1) } } } } close(m,false) } } } } flush(stream1) close(stream1) }Text |
|
![]() |
|
![]() |
|
Srikanth,
The load funciton you are using works with the Current view only. Try changing the code segement as follows: current = m for viewName in views current do { stream1 << " View Name: " viewName "\n" stream1 << " ---------" "\n" load view(viewName) // ----------------->Views Should get loaded properly for c in current do { Also, forgot to tell you that when you issue the edit you must have the visible parameter set to true. Edited: 24-Feb-2004 at 17:19 by Douglas Zawacki |
|
![]() |
|
![]() |
|
DXL us easier to read if you paste it into the [Attach Code] window (see the button below), rather than pasting it directly into the message window.
One of "Louie's Tidbits" threads talked about the trickiness of the "current" module. Basically, issuing a module open command (read/edit/share) will change the current module only if the opened module was not already open. Also, many commands, especially attribute commands, presume the current module. Therefore you need to explicetly set the current module at key locations in the code. Usually this means setting it after you open a module, and it certainly means setting it before you start using these commands (like find attribute). A great piece of information to have for all scripts is whether or not the script is running from a module or not; usually this means every script has code at the top that looks like: ...... Module mCurr = current ...... if (null mCurr){ack("Run from open module"); halt} Since your code CAN run without a current module you wouldn't need that second line, but the first line is usually important to know later on. Anyway, [1] your "m = currrent" command that follows the "m = edit..." command looks fishy; I suspect you mean "current = m". [2] I don't think you need (or want) to be changing the current folder; so remove the "current = folder ..." line of code. [3] Views only load for VISIBLE modules, not INVISIBLE ones. Change your "false" to "true" in the "m = edit(...)" command. [4] At the very bottom consider adding a "system("Notepad.exe \" C:\\DOORSOUTPUT/text1.txt \")" command, to display your output report. [5] Don't close m if its the original module; in this case "if (m != mCurr) close(m, false)" I think [3] is your problem. - Louie |
|
![]() |
|
![]() |
|
Thanks to Doug and Louie for your answers. I guess I need to make the module visible as you guys say which I didnt wanted to do initially. Thanks for pointing it out for me.
|
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.