Subject Re: Master detail relationship, Masterlinks with date type
Author moczaz
--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
> > > Try forcing the date columns to be cast as TDate. It still
won't
> > > necessarily solve the problem, though, because a "raw" date
> >portion under
> > > the hood in Delphi and IBO is mm/dd/ccyy, whereas, at some
level,
> >your
> > > dates are being changed to ccyy/mm/dd.
> >
> >What do you mean by forcing the date columns to be cast as TDate?
> >I think that setting up MasterLinks with date columns
> >(namely MasterLinks.Text:='WDATE=WDATE') causes the problem, but
> >I can't cast the columns here, can I?
>
> No; part of the trick would be to have the TIB_Column come
through as a
> TIB_ColumnDate, not a TIB_ColumnDateTime. But I think it's still
possible
> that you'll bump into format problems unless *every* casting
inside Delphi
> is done with AsDate, (not AsDateTime or Value or AsVariant) AND
you avoid
> reading values from the controls. Experiment with it and use the
> IB_MonitorDialog to watch the values that IBO sends through in the
> parameters to fetch the detail records.

Thank you for your help, I will try IB_MonitorDialog to understand
whats happening behind the scenes when using IBO.

It seems I managed to get around my problem of using date columns
in MasterLinks by using the OnPrepareSQL event of TIB_Query.
I wrote an OnPrepareSQL event handler for the detail dataset, which
adds a WHERE clause to the detail query with
TIB_Query.AddSQLWhereClause . It seems to me that it acts like
the master/detail relationship I desired so much.

Thank you Helen.

Zsolt