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: Can anyone help me with my code here?
Topic Summary:
Created On: 6-Sep-2002 10:41
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 Tony Goodman, on Thursday, September 12, 2002 3:39 PM

Answer:
The problem with your code is that the dot notation used to access an attribute actually returns a reference to the attribute, not the attribute itself. So you need to cast the returned value into the type you want. In this case a string. The best way to do this is to append the empty string to the expression. I have changed the if statement in the code below to demonstrate this. Also, I suggest you always use parentheses around the if expression and always use braces, even for single line statements.
 12-Sep-2002 10:41
User is offline View Users Profile Print this message


Hong Zhang

Posts: 29
Joined: 12-Sep-2002

Hello everyone,

I am new here.

Can anyone tell me what's wrong with my code here?

create object type "String" inherit true attribute "tcs"

Object o = current Module m = current for o in all m do { if (o."Object Heading" == "1.1 Initial Registration") o."tcs" = "Initial Registration" }

The error message that I got was: E- DXL: incorrect arguments for (==) -E- DXL: incorrect arguments for (if) -I- DXL: all done with 2 errors and 0 warnings

thanks a lot, hong
Report this to a Moderator Report this to a Moderator
 12-Sep-2002 10:59
User is offline View Users Profile Print this message


Tony Goodman

Posts: 1098
Joined: 12-Sep-2002

Answer Answer
The problem with your code is that the dot notation used to access an attribute actually returns a reference to the attribute, not the attribute itself. So you need to cast the returned value into the type you want. In this case a string. The best way to do this is to append the empty string to the expression. I have changed the if statement in the code below to demonstrate this. Also, I suggest you always use parentheses around the if expression and always use braces, even for single line statements.

-------------------------
Tony Goodman
http://www.smartdxl.com
Report this to a Moderator Report this to a Moderator
 23-Sep-2002 23:27
User is offline View Users Profile Print this message


Gyan Penrose-Kafka

Posts: 10
Joined: 12-Sep-2002

Additionally, unless you are actually putting in the numeric outline values in the heading (ie. "1.1") you will never get a match because the DOORS assigned outline number isn't actually part of the heading.

For example,

ID Main Column
test-11 1 First Heading Object.
test-12 1.1 Initial Registration

string temp
Object o
Module m
for o in m do
{
temp = o."Object Heading"
print temp "\n"
}



First Heading Object.
Initial Registration


-------------------------
Gyan Penrose-Kafka
Requirements Management Consultant
gyan@zenmonkey.net
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.