![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
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 |
![]() |
![]()
|
![]() Answer: Hi Chris, in Layout DXL there is a handle to currently evaluated Object called obj ![]() Greetings Reik | |
![]() |
|
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 |
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
Eureka Reik!!!
That was the last piece of the puzzle. Your suggested code works just fine!! Thanks, Chris |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Count number of days based on attribute value
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.