Subject | Re: [IBO] NOT NULL/COMPUTED on query |
---|---|
Author | Helen Borrie |
Post date | 2002-10-25T09:43:25Z |
At 11:32 AM 25-10-02 +0200, you wrote:
where "date 0" is 17 November 1878 (or thereabouts). The answer is - don't
store a date of zero. If you want your trigger to kick in, then set the
REQUIRED property of this field in the dataset's ColumnAttributes to false
and perform the Clear method on it...even better is to exclude it from your
SQL statement altogether.
Also, a database column is NOT a COMPUTED column. Use this attribute for
columns that are calculated by the SQL of your query.
Some examples:
select fielda as MyField1
sum(aField) as Total
FirstName || ' ' || LastName as FullName
Abs(xField)
and any subquery output fields are also COMPUTED.
Helen
>Hi NG!It is neither. Dates in IB are stored in a numerical format on a time-line
>
>There is a table with a field SAMPLEDATE DATE NOT NULL and a trigger
>BEFORE INSERT: IF (NEW.SAMPLEDATE is null) then
>NEW.SAMPLEDATE=current_date
>
>I set up a query and a grid, I want empty fields to be sent as null, as
>I expect them to be converted by the trigger.
>
>So I check: EMPTY AS NULL and COMPUTED in the fields.
>
>IBO reads the NOT NULL constraint of the fields from the table and
>obviously won't send NULL but 0. As a result I get a date from the
>nineteenth century.
>
>Is it a bug or a feature?
where "date 0" is 17 November 1878 (or thereabouts). The answer is - don't
store a date of zero. If you want your trigger to kick in, then set the
REQUIRED property of this field in the dataset's ColumnAttributes to false
and perform the Clear method on it...even better is to exclude it from your
SQL statement altogether.
Also, a database column is NOT a COMPUTED column. Use this attribute for
columns that are calculated by the SQL of your query.
Some examples:
select fielda as MyField1
sum(aField) as Total
FirstName || ' ' || LastName as FullName
Abs(xField)
and any subquery output fields are also COMPUTED.
Helen