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: Switch or "Select case" statement
Topic Summary:
Created On: 7-Jul-2008 13:59
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.
 7-Jul-2008 13:59
User is offline View Users Profile Print this message


Thiago Rüdiger

Posts: 1
Joined: 30-Jun-2008

Dear Friends,

I would like to know if exist any statement in DXL like Switch or Select Case. I've already looked at the documentation and haven't find it.

Thank you.
Report this to a Moderator Report this to a Moderator
 7-Jul-2008 14:03
User is offline View Users Profile Print this message


ron lewis

Posts: 650
Joined: 20-Sep-2004

Thiago, DOORS DXL has no such critter, yet.

However, you can make a substitue that may meet your needs, as follows:

Edited: 7-Jul-2008 at 16:11 by ron lewis
Report this to a Moderator Report this to a Moderator
 7-Jul-2008 14:55
User is offline View Users Profile Print this message


Pekka Mäkinen

Posts: 276
Joined: 18-Mar-2004

If you run this "dxl" code

int n = 0
switch(n)
{
case 1: ack "1"
break
}

you get the following error messages:

-E- DXL: <Line:4> incorrect arguments for 'case' statement
-E- DXL: <Line:2> incorrect arguments for 'switch' statement
-E- DXL: <Line:7> switch not yet supported
-I- DXL: all done with 3 errors and 0 warnings

in DOORS 8.3

-------------------------
Pekka.Makinen@softqa.fi
SoftQA Oy -http://www.softqa.fi/
Report this to a Moderator Report this to a Moderator
 8-Jul-2008 17:40
User is offline View Users Profile Print this message


David Jakad

Posts: 94
Joined: 20-Jul-2007

In lieu of a case statement, I have used something like the following:

void doCaseStatement(string myTest) {
bool done = false
while(!done) {
if(myTest=="Case 1") {doFunction1;break}
if(myTest=="Case 2") {doFunction2;break}
if(myTest=="Case 3") {doFunction3;break}
if(myTest=="Case 4") {doFunction4;break}
if(myTest=="Case 5") {doFunction5;break}
if(myTest=="Case 6") {doFunction6;break}
if(myTest=="Case 7") {doFunction7;break}
if(myTest=="Case 8") {doFunction8;break}
doDefaultFunction
done=true
}
}

The "break" will break out of the while loop. The "done" flag will ensure the while loop is executed only once. This probably isn't any better than a bunch of if/elseif statements, but it is another method. The following is pretty much equivalent:

void doCaseStatement(string myTest) {
if(myTest=="Case 1") {doFunction1}
elseif(myTest=="Case 2") {doFunction2}
elseif(myTest=="Case 3") {doFunction3}
elseif(myTest=="Case 4") {doFunction4}
elseif(myTest=="Case 5") {doFunction5}
elseif(myTest=="Case 6") {doFunction6}
elseif(myTest=="Case 7") {doFunction7}
elseif(myTest=="Case 8") {doFunction8}
else {doDefaultFunction}
}

Edited: 8-Jul-2008 at 20:06 by David Jakad
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 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 1 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.