![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: ad.defval Topic Summary: Created On: 29-Jun-2007 18:36 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Given AttrDef ad; as specified below, I conclude the following vis-a-vis using 'ad.defval':
[] bool HasDef = ad.defval // Returns whether there is a default value [] if (ad.defval) // Returns whether there is a default value [] string Value = ad.defval // Returns the default value; DXL error if attr doesn't have one [] string Value = ad.defval "" // Concatenating ad.defval with anything corrupts the current instance of DOORS, which triggers execption viloations every time thereafter ad.defval is used; until DOORS exits. [] (bool addr_ (int ad.defval)) "" // Schroder's suggestion; this returns null if the base attr type isn't 'Enumeration', returns 'false' if the base type of the attr is Enumeration and the default is the first one in the list (such as type Boolean with 'False' as the default), and returns 'true' when Enumeration but default value is not the first one in the list. It appears (int ad.defval), for Enumerations, returns the position of the default in the list. [] string and text attrs' default comes back in Rich Text. I notice the following: [] Boolean enumerations are 'True' and 'False'; not 'true' and 'false' (no first capital). Thus function fIsTrue is used to do a quick conversion. I advise the following: [] NEVER do this: ad.defval "" [] check if (ad.defval) before string Val = ad.defval [] In the attached, functions fBaseType and fDefVal and fIsTrue are fairly useful. [] Use plainText() to get rid of RichText from text and string attrs. I discovered this as follows: I created a set of "aa" attributes that have a default value; one such attr def for each Type in the module. I could not create an attr def that has a null default value. I also created a set of "bb" attributes that don't have a default value, one for each Type. Boolean attr aaBool has default value false. I created Type Boolean1 of type Enumeration where True was first and False was 2nd (different than 'Boolean' where False is first). I created attr def aaBool1 of type Boolean1 where False was the default. I ran the attached, opting to [Cancel] attempts to trigger exception violations. Copied the print out to Excel. It looks good, attributes with defaults are printed, specifically noticing that the default for attr aaBool is correctly "False". I ran the attached, opting to [Confirm] attempt to trigger exception violations. That causes line <adViolation = ad.defval ""> to execute. Once that's run, exception violations when dealing with any ad.defval is inevitable and continuous, until you exit DOORS. This includes attempting to edit attribute defs via the GUI. - Louie |
|
![]() |
|
![]() |
|
Thanks Louie for all that code! I needed a function that would return a string of the default value of an attribute, and I modified your work to do just that!
One question though: what does addr_ do? I didn't find info about it on the forum nor the DXL manual. Jason |
|
![]() |
|
![]() |
|
addr_ returns a C-like pointer on the following argument. It permits both to get or set address of any variable.
It is then useful to force "type casting" It is documented in the API DOORS Manual only. (pdf on installation CD and/or download from support.telelogic.com) Louie, I remember having strange results while trying to assign default value of Date attributes to string variables with DOORS 5 and 7. Do you know if it was fixed with DOORS 8 ? ------------------------- E. Piallat CeBeNetwork |
|
![]() |
|
![]() |
|
Don't understand your 'Date' question.
Golly, missed that in the API manual. Very interesting. I notice that the 'Impact on Triggers' sections a couple pages later is incorrect, the dynamic pre-close module trigger of course persists until the module is closed and of course has nothing to do with the dialog, whether its shown or not. And so, that makes me wonder in what 'context' the trigger exists. No doubt the code that defines the trigger terminates when the script ends (or dialog is closed), but the trigger is stored with the open module and isn't really in a DXL context until it fires. - Louie |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
ad.defval
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.