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: Pattern wizard in the kitchen
Topic Summary: copying first 20 char of object text to attribute
Created On: 27-Nov-2007 11:18
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 Elbert Mol, on Tuesday, November 27, 2007 4:02 PM

Answer:
Louie

Thanks! You helped me out very well.

There seems to be an error in line 38. For now I put a // in the beginning of the line.
Then the script runs and gives the desired result.

I will study the code in detail later.

Regards,

Elbert
 27-Nov-2007 11:18
User is offline View Users Profile Print this message


Elbert Mol

Posts: 10
Joined: 11-Dec-2006

I am looking for regular expression to copy the first 20 characters of object text to a attribute. e.g. object short text.
Report this to a Moderator Report this to a Moderator
 27-Nov-2007 12:06
User is offline View Users Profile Print this message


Peter Albert

Posts: 232
Joined: 30-Dec-2005

There is no need for a regular expression, nor for the kitchen library:

(current Object)."Object Short Text" = ((current Object)."Object Text" "")[0:19]

As this approach may waste space in the string table, you might want to consider buffers:

Buffer b = create
b = (current Object)."Object Text"
b = b[0:19]
(current Object)."Object Short Text" = tempStringOf b
delete b

Regards,

Peter
Report this to a Moderator Report this to a Moderator
 27-Nov-2007 12:45
User is offline View Users Profile Print this message


Elbert Mol

Posts: 10
Joined: 11-Dec-2006

Peter, thanks for the suggestion.

I tried to avoid working directly in DXL because I just started working with DOORS.
Working in DXL means programming a whole script.

The pattern wizard in the Kitchen provides a user just to load a pattern and if necessary change the number of characters to be placed into the attibute.
Report this to a Moderator Report this to a Moderator
 27-Nov-2007 14:08
User is offline View Users Profile Print this message


Peter Albert

Posts: 232
Joined: 30-Dec-2005

Well, I don't find the pattern wizard in the Kitchen, could you tell me where it is? And secondly, it is not a bad idea to start getting into DXL, you will need it anyway sooner or later.

Regards,

Peter
Report this to a Moderator Report this to a Moderator
 27-Nov-2007 14:33
User is offline View Users Profile Print this message


Elbert Mol

Posts: 10
Joined: 11-Dec-2006

The Dutch Kitchen was supplied with a Pattern Wizard.

Apparently it is unavoidable to start using DXL.

Do you have a suggestion how to apply your script for all object in the module?

Thanks in advance.

Regards,
Elbert
Report this to a Moderator Report this to a Moderator
 27-Nov-2007 15:19
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

There are basicially two object loops:
[1] for obj in mod do. This loop respects the current display set, which means if deleted objects are not showing the loop won't find them, and if objects are filtered out the loop won't find them. I only ever use this loop if I have some kind of module interactive script where the user may run the script multiple times on the same module, adjusting the display each time.
[2] for obj in entire mod do. This loop finds each object starting from the top, regardless of display state. This loop will work the same way regardless of filtering or sorting or leveling or which view is loaded. I routinely use this loop. Right after the loop I typically exclude objects I don't want to deal with.

See attached. Didn't try it, so if you get DXL errors then try to fix them.

- Louie

Edited: 27-Nov-2007 at 15:32 by Louie Landale
Report this to a Moderator Report this to a Moderator
 27-Nov-2007 16:02
User is offline View Users Profile Print this message


Elbert Mol

Posts: 10
Joined: 11-Dec-2006

Answer Answer
Louie

Thanks! You helped me out very well.

There seems to be an error in line 38. For now I put a // in the beginning of the line.
Then the script runs and gives the desired result.

I will study the code in detail later.

Regards,

Elbert
Report this to a Moderator Report this to a Moderator
 27-Nov-2007 16:50
User is offline View Users Profile Print this message


Peter Albert

Posts: 232
Joined: 30-Dec-2005

// I wonder if this is better: ??? if (length(buf) > TruncateLength) length(buf) = TruncateLength ???


It is orders of magnitude faster ... when executed 10.000 times, length(buf, TruncateLength) executes in 0 seconds, the original approach in 5 seconds.

As for line 38, just add the last closing bracket after cell(oCurr) (there should be 3 of them).

Regards,

Peter
Report this to a Moderator Report this to a Moderator
 28-Nov-2007 08:03
User is offline View Users Profile Print this message


Elbert Mol

Posts: 10
Joined: 11-Dec-2006

Peter,
Thanks for the extra info.

I changed your suggestion:

if (length(buf) > TruncateLength) length(buf) = TruncateLength

to: if (length(buf) > TruncateLength) length(buf,TruncateLength)

then a module with over 6000 objects runs in 2 seconds (before 5 seconds)

regards,
Elbert
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.