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: Count number of days based on attribute value
Topic Summary: DXL script for counting the # of Days, using "if" statements
Created On: 2-Jul-2007 18:20
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 Reik Schroeder, on Monday, July 2, 2007 9:18 PM

Answer:
Hi Chris,

in Layout DXL there is a handle to currently evaluated Object called obj



Greetings
Reik
 2-Jul-2007 18:20
User is offline View Users Profile Print this message


Chris Annal

Posts: 36
Joined: 14-Dec-2005

Here's another example of me starting to write what would seem to be simple DXL. In this case, I'm trying to count the number of days a particular item was "open". I want to track Action Items for a given project, and how long it takes to close them. I'll need the script to first look at whether that Action Item is (attribute "Status") is either "Closed" or "Open" (attribute enumerated values). The problem I seem to be having in this case is, no matter how I use brackets, parenthesis, etc with my "if" statements (see attached code), I keep getting an "incorrect arguments for if" message when trying to execute the DXL. I've tried the following:
1.
for oAI in m do {
string sStatus = oAI."Status"
 if (sStatus == "Closed")  // use 2 equal signs
do something
}

2.
for oAI in m do {
string sStatus = oAI."Status"
 if (sStatus = "Closed") { //use 1 equal sign

3.
for oAI in m do {
string sStatus = oAI."Status"
 if ((sStatus) == "Closed") { //use parenthesis around the "sStatus" variable, and so on.

No matter how I play around with brackets and/or parenthesis in my "if" statements, I can't get the DXL to work. The entire code is attached, and perhaps it's somewhere else in the code that needs fixing. I've also tried replacing the "if" statements with "for" loops, but ended up crashing DOORS with those efforts, so I'm going with the safer "if" statement approach with no luck so far. Any suggestions are welcome,

Thanks,

Chris


Report this to a Moderator Report this to a Moderator
 2-Jul-2007 19:09
User is offline View Users Profile Print this message


Reik Schroeder

Posts: 361
Joined: 28-Jul-2003

Hi Chris,

I do not see any syntax problems in your code.
In my Doors 8.1 session it runs without errors, but it may not be usefull to use the display function outside layout dxl

Greetings
Reik

-------------------------
Evosoft GmbH
for Siemens Industry Sector


Berlin, Germany
Report this to a Moderator Report this to a Moderator
 2-Jul-2007 19:26
User is offline View Users Profile Print this message


Chris Annal

Posts: 36
Joined: 14-Dec-2005

Thanks Reik,

You're right. I don't know why I was getting the "incorrect aguments" messages before, but when I just executed the script it worked fine. By the way, this is for a layout dxl column, so you're also right about using "display".
The only issue I have now is that I'd like to make this work on a "per each object" basis. Right now, it seems like for every object, the information in the dxl column displays ALL the information for every object in the module, versus just displaying it for each individual object. I deliberately avoided the use of "current object" because that will only display the calculated age of a currently selected object. I'm going back to the drawing board on that part, but if you or anyone else have any ideas on how to display the results of this script on a "per object" basis, versus all the information for every object, I'm open to suggestions.
Thanks again!!
Chris
Report this to a Moderator Report this to a Moderator
 2-Jul-2007 20:21
User is offline View Users Profile Print this message


Reik Schroeder

Posts: 361
Joined: 28-Jul-2003

Answer Answer
Hi Chris,

in Layout DXL there is a handle to currently evaluated Object called obj



Greetings
Reik

-------------------------
Evosoft GmbH
for Siemens Industry Sector


Berlin, Germany
Report this to a Moderator Report this to a Moderator
 2-Jul-2007 21:21
User is offline View Users Profile Print this message


Chris Annal

Posts: 36
Joined: 14-Dec-2005

Eureka Reik!!!

That was the last piece of the puzzle. Your suggested code works just fine!!

Thanks,

Chris
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 2 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 2 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.