![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
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 |
![]() |
![]()
|
![]() 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. | |
![]() |
|
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 |
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
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 |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Can anyone help me with my code here?
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.