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: ad.defval
Topic Summary:
Created On: 29-Jun-2007 18:36
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.
 29-Jun-2007 18:36
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

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
Report this to a Moderator Report this to a Moderator
 17-Mar-2008 19:17
User is offline View Users Profile Print this message


jason haury

Posts: 39
Joined: 20-Feb-2007

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
Report this to a Moderator Report this to a Moderator
 18-Mar-2008 22:09
User is offline View Users Profile Print this message


Eric Piallat

Posts: 33
Joined: 26-Jan-2004

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
Report this to a Moderator Report this to a Moderator
 19-Mar-2008 18:09
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

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
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.