Subject Re: [IBO] RefinedSQL and assigning problem
Author Steve Fields
--- In IBObjects@yahoogroups.com, "Steve Fields"
<stevefields2424@y...> wrote:
> --- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
> > At 04:22 PM 8/09/2005 +0000, you wrote:
> > >Hi all,
> > >
> > >I am trying to execute the statement(s):
> > >(TIB_Query's, IB 4.5B, D5 Ent)
> > >
> > >SecMasterQuery.SQL.Text := MasterQuery.RefinedSQL;
> > >SecDetailQuery.SQL.Text := DetailQuery.RefinedSQL;
> > >
> > >but right after assigning this value the My_Query
> > >SQL text does not show any change. Could there be
> > >any settings that would prevent setting this text?
> >
> > You should never try to "assign" a statement by setting the SQL.Text
> > property. This doesn't just go for the TStrings classes that IBO
uses,
> > it's a general rule for TStrings. Although the Text property of a
> TStrings
> > is writable, it is almost never used for writing. The class is
> designed to
> > *deliver* a string based on the content of the indexed strings within.
> >
> > To pass the current SQL from one statement object to another, use
> > AssignSQLWithSearch
>
To refine this description a little further:

I have a Master and a Detail (M1, D1). In the second instance I
have a Master and a linked detail also (M2, D2) that I use for a
printed report. I do not want these two sets of tables to be
attached to each other, with the second set essentially transparent
to the user. The user may elect to sort the D1 dataset based on a
different key field than the default one and then see the results
of the sort on a printout attached to the second two datasets. At
present I have tried setting the RefinedSQL from D1 to D2 but it
does not _take_. I then tried the AssignSQLWithSearch method but
it also did not reflect ANY changes in D2s sql statement. I tried
to clear the SQL statement of D2 and one by one add the stsements
from D1. This also did not work. I am using two TIB_Grids that are
attached to M1 and D1, while letting the user select individual
lines in the D1 grid as needed, and clicking on the title columns
to effect sorting. Still noting works or it even gives me a "Cannot
prepare a blank statement". I find it hard to believe that the
excellent property of RefinedSQL is only good for reading but not
using somewhere else, or I am missing something. (BTW I tried using
GetText and SetText but they do not work for some reason either)

Thanks,
Steve Fields