Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
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
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by Srikanth Chalasani, on Tuesday, February 24, 2004 5:51 PM

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.

 24-Feb-2004 16:30
User is offline View Users Profile Print this message


Srikanth Chalasani

Posts: 13
Joined: 4-Nov-2003

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
Report this to a Moderator Report this to a Moderator
 24-Feb-2004 16:47
User is offline View Users Profile Print this message


Douglas Zawacki

Posts: 97
Joined: 14-Aug-2003

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
Report this to a Moderator Report this to a Moderator
 24-Feb-2004 17:25
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

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
Report this to a Moderator Report this to a Moderator
 24-Feb-2004 17:51
User is offline View Users Profile Print this message


Srikanth Chalasani

Posts: 13
Joined: 4-Nov-2003

Answer 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.

Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 0 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 0 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.