Subject | Re: [IBO] TIB_Date questions |
---|---|
Author | Helen Borrie |
Post date | 2003-03-06T23:06Z |
At 10:26 PM 6/03/2003 +0000, you wrote:
Windows date settings, use the FieldsDisplayFormat property. Delphi is
notoriously unfriendly about date formats.
Marco Menardi is the TIB_DateEdit specialist - I'll defer to him for more
precise comments
to do it once.
For an example, I'll use FieldsDisplayFormat - because (apologies) I don't
have time to work out editmask examples right now. But the same steps
apply to FieldsEditMask and any of the other FieldsXxxx settings.
Let's say you define two date domains, DT_DATEONLY and DT_DATETIME for
dialect 3 DATE and TIMESTAMP types respectively.
Then, include fetDomainName in the FieldEntryTypes set.
In the FieldsDisplayFormat, make these two entries (example only):
DT_DATEONLY=dd-MMM-yyyy
DT_DATETIME=dd-MMM-yyyy hh:nn:ss
This will cause IBO to use these DisplayFormats every time it encounters a
database field under one of these domains.
The other way (without domains) is to include fetSQLType in the
FieldEntryTypes set and, in the FieldsXxxxx property, to list the
fully-qualified database column names and their property value. E.g. in
FieldsDisplayFormat,
TABLEA.START_DATE=dd-MMM-yyyy
TABLEB.UPDATE_TIMESTAMP=dd-MMM-yyyy hh:nn:ss
.....
You can also do the same things at dataset-column level (with a lot more
typing!); but you can use the dataset-level settings to override the
connection-level settings.
With care, you can also use both. Include both fet... members in
FieldEntryTypes. Just watch that you don't create conflicting rules; but
you can set up a domain rule in the ib-connection and override it with a
dataset-level SQLType rule.
Helen
>Hi there,To get it to display exactly as you want it every time, and ignore the
>
>I have two questions:
>A) When the focus is in an IB_Date component, and the space is
>pressed, todays date comes up, but when I step off the component I
>get an error "07/Mar/2003" is an invalid date. I obviously have my
>Control Panel date settings to dd/mmm/yyyy, so I can understand
>this, but when I drop down the component and select some date, say
>01/May/2002, and step off the component, no error occurs. Yet this
>clearly has the mmm part as well.
>This seems like an incopsistency to me, which doesn't make sense.
>I would really like the space=now option, and also keep my
>dd/mmm/yyyy format.
>Any ideas?
Windows date settings, use the FieldsDisplayFormat property. Delphi is
notoriously unfriendly about date formats.
Marco Menardi is the TIB_DateEdit specialist - I'll defer to him for more
precise comments
>B) I have many many date fields throughout my app, and want toYou can do it one of two ways, but using domains means that you only have
>centralise the edit mask, which I have just read I can do with the
>IB_Connection component using the FieldEntryType, but I don't quite
>understand how to do this.
>Do I need to change all my DATE fields to a domain based on the DATE
>type?
to do it once.
For an example, I'll use FieldsDisplayFormat - because (apologies) I don't
have time to work out editmask examples right now. But the same steps
apply to FieldsEditMask and any of the other FieldsXxxx settings.
Let's say you define two date domains, DT_DATEONLY and DT_DATETIME for
dialect 3 DATE and TIMESTAMP types respectively.
Then, include fetDomainName in the FieldEntryTypes set.
In the FieldsDisplayFormat, make these two entries (example only):
DT_DATEONLY=dd-MMM-yyyy
DT_DATETIME=dd-MMM-yyyy hh:nn:ss
This will cause IBO to use these DisplayFormats every time it encounters a
database field under one of these domains.
The other way (without domains) is to include fetSQLType in the
FieldEntryTypes set and, in the FieldsXxxxx property, to list the
fully-qualified database column names and their property value. E.g. in
FieldsDisplayFormat,
TABLEA.START_DATE=dd-MMM-yyyy
TABLEB.UPDATE_TIMESTAMP=dd-MMM-yyyy hh:nn:ss
.....
You can also do the same things at dataset-column level (with a lot more
typing!); but you can use the dataset-level settings to override the
connection-level settings.
With care, you can also use both. Include both fet... members in
FieldEntryTypes. Just watch that you don't create conflicting rules; but
you can set up a domain rule in the ib-connection and override it with a
dataset-level SQLType rule.
Helen