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: module level attribute
Topic Summary: module level attribute
Created On: 31-Aug-2006 14:26
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 Louie Landale, on Monday, September 4, 2006 9:15 AM

Answer:
Please use the [Attach Code] button at the bottom of the Reply screen to house your DXL. Much easier to read. You also seem to be hitting submit twice; hit it once and be patient. Anyway ...

[] Your 'display(total "")' line should come after the brace } following it: calculate the total from all object, THEN display the result once.

[] Attr DXL doesn't use the 'display' command; instead use 'obj.attrDXLName = total ""' instead.

[] If you make the above changes, then only the top object displayed will get a value for this attribute, all others will be empty (since the code doesn't calculate for them). I believe that results like of code needs to be changed to '(current Module)."Total Cost" = total ""'; thus setting the module attribute to the total calculated.

[] Understand this reality of AttrDXL: of the result is null then its recalculated constantly. A space, however, does not trigger recalculation. Thus, AttrDXL should routinely have code like this at the bottom:
string Results = whatever the results.
if (null Results) Results = " "
obj.attrDXLName = Results

Do that, and the AttrDXL updates as specified in the manual.

In this case, if you set the module level attribute as above, the last line in this AttrDXL should be: obj.attrDXLName = " ".

- Louie
 31-Aug-2006 14:26
User is offline View Users Profile Print this message


martin allman

Posts: 74
Joined: 25-Jul-2005

I have created two attributes within my module one with a scope of module called "total cost" and the other with object scope called Cost create object type "Integer" attribute "Cost" create module type "Integer" attribute "Total Cost" A user adds new values for Cost into the particular view within the module. I want 'Total Cost' to update each time a new value for 'Cost' is added by the user. Im not quite sure where and how I make the connection between 'Total Cost' and 'Cost' Ideally I want 'Total Cost' to automatically update each time a change is made to Cost. I would also like to show the value of 'Total Cost' within the module is this possible? Thanks for any help.
Report this to a Moderator Report this to a Moderator
 31-Aug-2006 15:01
User is offline View Users Profile Print this message


Reik Schroeder

Posts: 361
Joined: 28-Jul-2003

Hi Martin,

you could create a persistent post save trigger on attribute Cost. This one can update the value of Total Cost.
The only problem of this method is, that the Module needs to be opened in exclusive mode to modify the value of Total Cost.
Be carefull with creating the trigger, it will be stored in database and is immediately active!

I would suggest to write the trigger code into an extra file wich you then load with readFile into a string. This string then can be checked with checkDXL and if succesful it can be used to create the trigger.

I do not know a method to display the Module attribute in view - you can see them in Module's properties.

Greetings
Reik

-------------------------
Evosoft GmbH
for Siemens Industry Sector


Berlin, Germany
Report this to a Moderator Report this to a Moderator
 31-Aug-2006 15:01
User is offline View Users Profile Print this message


Reik Schroeder

Posts: 361
Joined: 28-Jul-2003

Hi Martin,

you could create a persistent post save trigger on attribute Cost. This one can update the value of Total Cost.
The only problem of this method is, that the Module needs to be opened in exclusive mode to modify the value of Total Cost.
Be carefull with creating the trigger, it will be stored in database and is immediately active!

I would suggest to write the trigger code into an extra file wich you then load with readFile into a string. This string then can be checked with checkDXL and if succesful it can be used to create the trigger.

I do not know a method to display the Module attribute in view - you can see them in Module's properties.

Greetings
Reik

-------------------------
Evosoft GmbH
for Siemens Industry Sector


Berlin, Germany
Report this to a Moderator Report this to a Moderator
 31-Aug-2006 17:08
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Triggers are far too tricky for new folks. The notion of having the trigger #include the actual code only works if everyone using the database has R access to a specific server directory file (where you store the code); which is typically not the case.

I tried to define an AttrDXL for a module-level attribute; didn't work.

You can, however, define an object level Attr DXL with name perhaps "Hidden See Landale". Its job is simply to calculate the Total Cost module value based on all the Object's Cost value. It would first check the (previous(obj)) and if its null, then loop through all the objects, accumuote Total Cost, then set mod."Total Cost" = total. if the Previous object was not null this Attr DXL does nothing; thus it only fires up once rather than for all object. It would need to insure the module was open Exclusive, otherwise it couldn't set the value.
Report this to a Moderator Report this to a Moderator
 1-Sep-2006 12:07
User is offline View Users Profile Print this message


martin allman

Posts: 74
Joined: 25-Jul-2005

Hi Louie

Thank you for your reply to my query on the doors dxl forum, your suggestion is the one that I am trying to follow(as you pointed out the idea of using a trigger had me in a bit of a flap). So far I have come up with the code shown below, I've inserted this as a layout DXL column, but it does not work for me, can you offer me any pointers.

Many thanks Martin

int hold = 0

int total = 0

Object oCurr

if(next(obj) == null)

{

for oCurr in (current Module) do

{

hold = oCurr."cost"

total = total + hold

display(total "")

}

}

else

{

 

}

Report this to a Moderator Report this to a Moderator
 1-Sep-2006 16:17
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Answer Answer
Please use the [Attach Code] button at the bottom of the Reply screen to house your DXL. Much easier to read. You also seem to be hitting submit twice; hit it once and be patient. Anyway ...

[] Your 'display(total "")' line should come after the brace } following it: calculate the total from all object, THEN display the result once.

[] Attr DXL doesn't use the 'display' command; instead use 'obj.attrDXLName = total ""' instead.

[] If you make the above changes, then only the top object displayed will get a value for this attribute, all others will be empty (since the code doesn't calculate for them). I believe that results like of code needs to be changed to '(current Module)."Total Cost" = total ""'; thus setting the module attribute to the total calculated.

[] Understand this reality of AttrDXL: of the result is null then its recalculated constantly. A space, however, does not trigger recalculation. Thus, AttrDXL should routinely have code like this at the bottom:
string Results = whatever the results.
if (null Results) Results = " "
obj.attrDXLName = Results

Do that, and the AttrDXL updates as specified in the manual.

In this case, if you set the module level attribute as above, the last line in this AttrDXL should be: obj.attrDXLName = " ".

- Louie
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 2 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 2 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.