Subject Re: [IBO] Fill titles in a query in execute time
Author Frank Ingermann
Hi Jason,

i wrote:
> take a look at the fieldsxxx properties:
>
> with ib_query1 do
> begin
> sql.add('select emp_no from employee');
> FieldsGridLabel.Add('emp_no=Employee Number');
> FieldsAlignment.Add('emp_no=left');
> prepare;
> open;
> end;

you wrote:
> Look at the properties of the TIB_Column class.
> DisplayLabel and Alignment.
>
> Also, when using a buffered query, call Open or set Active to true to open
> it.
> Calling first may not do the trick unless the query has been opened first.

Now my question is: is there anything wrong in using the Fieldsxxx-props the
way i proposed for *dynamically* created sqls? Are there any drawbacks
(e.g. wrt. performance) when using the stringlists? The reason I do it like
this is that i find it easier to store the fields settings like this along
with the sql.

I have a table CustomQueries with a text blob for the sql and another
for the Fieldsxxx settings. When the user wants to save his settings, i
just save the sql and fill the FieldsSettings blob with an INI-style
stringlist that would look like

[FieldsGridLabel]
emp_no=Employee Number

[FieldsAlignment]
emp_no=left

in the above example. I like this because the user can re-order and re-size
the columns in the result grid and his settings go into the
FieldsIndex and FieldsDisplayWidth props, so when he later on uses the
same query again he will have the same grid settings back - and it works
quite nicely.

my understanding was that using FieldByName('<fld>').<prop> is looking at
the Fields array "from the top", while using the Fieldsxxx-stringlists is
looking "from the side"... (or vice versa depending on your pov :-)

Did i overlook something here, any pitfalls to avoid? (i surely don't want
to give advice here that takes others in the wrong direction!)

tia,
fingerman

P.S.: i'm probably so "hooked up on strings" because after a long time of
inactivity i'm finally completing my fiSPEd atm. (you may remember this
thing from the IBO workshop last year in Frankfurt). You can already take
a look at some screenshots on http://www.fingerman.de/fisped_screenshots.htm
I will contact you privatly about that since the thing will be Trustware
like IBO, but i'd like it to be free for IBO users during development, so
maybe we can make an arrangement for that.

> HTH,
> Jason Wharton
> CPS - Mesa AZ
> http://www.ibobjects.com