Subject | Re: [IBO] RefinedSQL and assigning problem |
---|---|
Author | Helen Borrie |
Post date | 2005-09-08T23:53:37Z |
At 04:22 PM 8/09/2005 +0000, you wrote:
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
Make sure that both datasets are in a condition where reassignment of the
SQL property is logically possible. For example, if you are re-assigning
the SQL of two dependent statements, then don't try to prepare or open one
before you have attended to the other.
The right place to do these changes is in the OnPrepareSQL event. That
means that the decision to change, e.g. a button-click event, must not
occur at a point where something else is going on, like part-way through an
edit or search operation. Ensure that the statement is actually going to
be prepared as a result of what your button-click does; otherwise there is
no OnPrepareSQL event and there will be no certainty about the state of the
objects.
Helen
>Hi all,You should never try to "assign" a statement by setting the SQL.Text
>
>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?
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
>I am trying to work a basic invoice type system whereSee above.
>there is one master and many detail records. After
>selecting one master record and linking the details,
>using masterlink/mastersource, I then also try to filter
>out some of the detail records using a TIB_SearchPanel and
>the resulting RefinedSQL text.
>After performing the filtering I then carry the master's
>SQL statement over to a second pair of TIB_Query components
>linked in the same way as the main two.
>After I carry the DetailQuery's SQL over, though, it refuses
>to make any changes to the second SQL statement, SecDetailQuery.
>Any ideas?
Make sure that both datasets are in a condition where reassignment of the
SQL property is logically possible. For example, if you are re-assigning
the SQL of two dependent statements, then don't try to prepare or open one
before you have attended to the other.
The right place to do these changes is in the OnPrepareSQL event. That
means that the decision to change, e.g. a button-click event, must not
occur at a point where something else is going on, like part-way through an
edit or search operation. Ensure that the statement is actually going to
be prepared as a result of what your button-click does; otherwise there is
no OnPrepareSQL event and there will be no certainty about the state of the
objects.
Helen