![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
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 |
![]() |
![]()
|
![]() 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 | |
![]() |
|
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.
|
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
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. |
|
![]() |
|
![]() |
|
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 {
} |
|
![]() |
|
![]() |
|
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 |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
module level attribute
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.