![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: get the 'active' attribute Topic Summary: Created On: 3-Aug-2007 10:07 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Hi,
these days I am struggling a bit with the triggers. Here is what I am trying to do: - once the user double-click on a specific object attribute(lets call it "comment"), insert automatically the user's signature in the attribute before the user starts writing his comment. "pre" event being not managed by the attribute trigger (as far as I understand) I came up using a pre-open trigger on the object. Thus the triggers fires everytime the user tries to edit one attribute of the object. At this stage I would like to get the name of the attribute the user edits in order to add the signature only when he edits the "comment" attribute and discard all other events. This being said: - attrdef(trigger) returns null since the trigger is defined for the object and not for an attribute - there is no such command attrdef ad = current attribute Any idea that could help? Thanks, Eric |
|
![]() |
|
![]() |
|
I can't give you access to the current attribute, but I would suggest to use an attribute pre-write trigger in combination with the
string value(Trigger t) perm. The attached script starts a trigger which automatically puts the user's name in front of any content put into the "Comments" attribute. It is no good, of course, if the user just updates existing content, as the trigger callback then keeps accumulating user names in the attribute value. Peter Edit: added code Edited: 3-Aug-2007 at 13:43 by Peter Albert |
|
![]() |
|
![]() |
|
Returning to an older thread...I have been working on this and found a solution by searching through this forum (thank you all ;-) and testing different methods.
The main method to get the attribute is to use the undocumented getInPlaceColumnIndex function and to employ this in a post-open trigger so that this function can get the current column number (does not work for pre-open trigger). Then if the selected column does not contain the wanted attribute, halt the trigger code. Some example code: string AttrName = "Product" int ColumnNum = getInPlaceColumnIndex(m) if (ColumnNum > -1) { Column c = column(m, ColumnNum) if (attrName(c) != AttrName) halt callStdItem_ (inplaceAttrItem) } else { halt } The problem with this approach is that when you double-click on a column and start some editing action on that attribute in a post-open trigger, you cannot actually make any modifications to the attribute value...DOORS will roll back the original value for that attribute, if the value was modified by the trigger code. This can be seen in history, as the attribute value is first modified and then rolled back to the original. But I got around this when I noticed that the trigger code can modify any other attribute than the attribute in column which was double-clicked. So that is the reason for the call "callStdItem_ (inplaceAttrItem)" in the example code, this will start in-place editing in the next attribute, and allow us to modify the attribute in the double-clicked column. But this has a feel of hack, so what is really going on....any ideas how to get around this limitation? ------------------------- Pekka.Makinen@softqa.fi SoftQA Oy -http://www.softqa.fi/ |
|
![]() |
|
![]() |
|
My notes show that the [1] 'string attribute(Trigger)' returns the name of the attribute defined in the Trigger scope, typically null. The [2] 'AttrDef attrdef(Trigger)' returns the AttrDef of the about to be saved in the Attr-Save trigger. [3] there is also a 'string attrdef(Trigger)' command which I assume like [2]. [4] the 'string value(Trigger)' is the value about to be stored in the attribute, for pre-save attr triggers.
You can have a pre-save attr trigger Defined for attribute 'Comments', which inserts the user's name before the 'value', manually inserts that into the Attr, and then denies the trigger from finishing via 'set(trigPreConFail)'. - Louie |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
get the 'active' attribute
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.