Larry,
I ready Razzak's reply and thought to myself: Rubbish! I'm doing that!
So I checked - I was wrong - no surprise there, then, but I was doing what I
think that you want:
Instead of using the default I use the compute and expression options:
I use .#DATE quite happily to get the insert date - surely others do this?
However, I tried (CVAL('NAME')) as the expression and added a row and got my
name in the column.
Regards,
Alastair.
----- Original Message -----
From: "A. Razzak Memon" <[EMAIL PROTECTED]>
To: "RBG7-L Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, July 15, 2004 7:31 PM
Subject: [RBG7-L] - Re: Problem with column DEFAULT
>
> 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.
>