Setting an attribute to a default value for new objects only

I have a multi-valued attribute with no current default. Some objects are set to non-default values; some have the default (blank). I want to set a default value for new objects only without affecting the existing objects. I can't seem to find a way to do this without introducing a new value (e.g. "N/A") for the objects that are currently blank.

Any suggestions on how to solve this problem?

Thanks,

             Ken.


mcnairk - Tue Nov 05 13:59:46 EST 2013

Re: Setting an attribute to a default value for new objects only
llandale - Tue Nov 05 15:51:21 EST 2013

I know of no way of changing the behavior that "null values" are the ones that get defaulted.  I would like to point out, however, that "defaulted" values (and "inherited" values) are not actually set, they just APPEAR to have the default value.  function "hasSpecificValue" can distinquish between a defaulted value and a value that is the same as the default.

Anyway, instead of new value "N/A" you could have new value " " (a space).

Tryiing to simulate a object-create trigger and setting the value explicitely is not realistic.

-Louie

Re: Setting an attribute to a default value for new objects only
mcnairk - Tue Nov 05 16:46:58 EST 2013

llandale - Tue Nov 05 15:51:21 EST 2013

I know of no way of changing the behavior that "null values" are the ones that get defaulted.  I would like to point out, however, that "defaulted" values (and "inherited" values) are not actually set, they just APPEAR to have the default value.  function "hasSpecificValue" can distinquish between a defaulted value and a value that is the same as the default.

Anyway, instead of new value "N/A" you could have new value " " (a space).

Tryiing to simulate a object-create trigger and setting the value explicitely is not realistic.

-Louie

Pretty much what I expected, but I'm not sure that your suggestion of a dummy value works. At least not when I tried it on DOORS 8.2. I created a new value of " " (a space), set an object to have this value, and then set a default. Much to my disappointment, it got changed to the default. I can try this on 9.5 but don't expect it to work any different.

I thought about as trigger for a microsecond, but they are the devils work and to be avoided at all costs!

Thanks,

Ken.

Re: Setting an attribute to a default value for new objects only
Mathias Mamsch - Wed Nov 06 06:28:16 EST 2013

mcnairk - Tue Nov 05 16:46:58 EST 2013
Pretty much what I expected, but I'm not sure that your suggestion of a dummy value works. At least not when I tried it on DOORS 8.2. I created a new value of " " (a space), set an object to have this value, and then set a default. Much to my disappointment, it got changed to the default. I can try this on 9.5 but don't expect it to work any different.

I thought about as trigger for a microsecond, but they are the devils work and to be avoided at all costs!

Thanks,

Ken.

The method of replacing default values by a real value works - we did this a lot during migrations with DOORS 8 and I just did it again on DOORS 9.4. Create an Enum Type with Values A,B,N/A. Create an attribute of it, set default value A. Set one object to A, one object to B leave the rest at default (A). Then change the attribute default to N/A. You should still have one object with Value A, one with Value B. If this would not work, something would be very wrong. But it seems you will indeed not solve your problem without introducing a new value N/A or " ". Regards, Mathias

Re: Setting an attribute to a default value for new objects only
mcnairk - Wed Nov 06 08:51:52 EST 2013

Mathias Mamsch - Wed Nov 06 06:28:16 EST 2013

The method of replacing default values by a real value works - we did this a lot during migrations with DOORS 8 and I just did it again on DOORS 9.4. Create an Enum Type with Values A,B,N/A. Create an attribute of it, set default value A. Set one object to A, one object to B leave the rest at default (A). Then change the attribute default to N/A. You should still have one object with Value A, one with Value B. If this would not work, something would be very wrong. But it seems you will indeed not solve your problem without introducing a new value N/A or " ". Regards, Mathias

Retested it and a blank " " is not replaced by the default value; I must not have done a save when I tested this earlier. So it seems that this is the best solution to my problem. Users (me for one) skim modules quickly looking for specific values of this attribute and they are much easier to spot when the majority are blank rather than N/A.

Thanks to both you and Louie for your help...

Ken.