At 08:29 AM 7/15/2004 -0700, Larry Lustig wrote:

I'm trying to define a table that has a CreateUser
column that will default to the current R:Base NAME
value.

The column appears to have the DEFAULT expression set
correctly:
 CreateUser         Type   : TEXT 8
                    Default: (CVAL('NAME'))
I would expect this to put, for instance, the name
TESTING into this column (I checked and CVAL('NAME')
correctly returns TESTING at the R> Prompt).

However, what I really get is (CVAL('N which is the
first 8 characters of the expression.

The next column (CreateDate DATETIME) is defined with
the default (DATETIME(.#DATE,.#TIME)).  This column is
getting a NULL Default.

Anyone know how to deal with this?  I would like to
use the default technique to set these columns rather
than having to rely on an AFTER TRIGGER update.


Larry,

Your AFTER TRIGGER approach will be more eloquent!

Let me tell you why.

The default values that are expressions are NEVER supported
in R:BASE.

The place for expressions as default values is in forms,
not the database definition. I tried this in older versions
and none of the versions I tried support an expression for
the default value. If you know of a specific version that
supposedly supports it, let me know. If you try to define
the default value for a date column as (.#DATE) in any
version of R:BASE, it will complain about the data type.
This is because (.#DATE) when interpreted as a string is
not a valid date. Default values as expressions are not
supported, including (CVAL('NAME')).

The above comments still apply. What we should do in the
RBDEFINE module is check that the default value is legal
for the type of the column and not allow expressions. An
expression will not work anyway.

Hope that explains!

Very Best R:egards,

Razzak.



Reply via email to