Subject Re: [IBO] Disappearing properties
Author Helen Borrie
Aage,
What you are observing is correct behaviour when you set properties at the dataset level. As soon as you change the dataset to a different set of columns, the user-set properties become unknown.

If you are swapping statements in and out of the same containers, you need to set your column properties at the connection level. The only differences are that (1) there isn't a grpahical editor for them so you need to add the values to the various StringProperty lists via the Object Inspector; and (2) you need to include the table identifier for the column, e.g. in FieldsCharCase, ATABLE.ACOLUMN=UPPER.

Now see my comment at the end of your message....


At 11:21 PM 02-07-01 +0200, you wrote:
>IBO/3.6Cd + Delphi/5 + Win2k
>
>The TIB_Query below works fine. But when the SQL property is replaced (at
>run time) with a similar query (or, even the same query), some properties
>of the TIB_Query seem to get wiped out.
>These properties are: FieldsCharCase and FieldsVisible.
>Additionally, the InsertSql doesn't seem to work any more: The SLNR value
>is (somehow) set to zero and (maybe because of further processing in the
>BeforePost event) things go south.
>
>If I - after replacing the SQL text - also explcitly puts the correct
>values back into FieldsCharCase and FieldsVisible everything seem to work
>properly again.
> FieldsVisible.Add('ID=F');
> FieldsVisible.Add('SLNR=T'); /* Not really necessary */
> FieldsCharCase.Add('LAND=UPPER');
>-- ID is the primary key of table DISTRIB
>-- SLNR is a "foreign key" (sort of - not _declared_ as such)
>
>I've struggled with this for some time, and would appreciate an explanation
>(or fix, if it is a bug in IBO).
>
>
>Regards,
>Aage J.
>
>
>
>Here is the query:
>select
> D.LAND, D.UTGAVE, D.U_DISTR, D.REGNR, D.RDATO,
> D.LANSERT, D.ALDER, D.UTGIVER, R.UTGIVER as RKV,
> D.RETTIGHET, D.LABEL, D.SP_TID,
> D.PRIS, D.F_BILDE, D.F_LYD, D.TNR,
> T.TITTEL, D.BARCODE,
> D.KOPIER, D.K_DATO, D.DIV, D.STATUS,
> D.FORBUDT, D.SLNR, D.ID
>from
> DISTRIB D left outer join UTGAVE_SORT U on D.UTGAVE = U.UTGAVE
> left outer join TITLER T on D.TNR = T.TNR
> left outer join REKV R on D.UTGIVER = R.KODE
> and D.LAND = R.LAND
>where D.SLNR = :SLNR
> and Upper(D.UTGAVE) not in ('KINO','INST')
>order by D.LAND collate no_no, U.RANG, D.RDATO, D.LANSERT
>for update
>
>The only change I make is adding another line in the where clause (and
>D.LAND = '<some value>') just before the OrderBy clause.

Instead of clearing the SQL property and putting in a complete new statement, you should make it just the "bare" statement (no WHERE criteria, no ORDER BY) and use the SQLWhereItems and SQLOrder properties to set criteria and ordering respectively. That way, the original statement and all its properties stay intact instead of getting reset as they do when you use the clear-and-totally-replace approach.

Regards,
Helen

All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________