Subject | Re: [IBO] Actual field names |
---|---|
Author | Lucas Franzen |
Post date | 2006-06-22T11:49:11Z |
Russell,
russellbelding schrieb:
GridTitelClick.
I do something like this in my database browser app:
procedure AddQryOrderFields;
var
ii: Integer;
sl: TStringList;
begin
// Add all query fields to the OrderingItemszulassen
sl := TStringList.Create;
with YourQry do
begin
OrderingItems.Clear;
OrderingLinks.Clear;
// add all query fields to the stringlist
GetFieldNamesList ( sl ); // method of IB_Statement
for ii := 0 to sl.Count - 1 do
begin
// add ordering item for ASCENDIMNG & DESCENDING
OrderingItems.Add ( sl[ii] + '=' + sl[ii] + ';' +
sl[ii] + ' DESC' );
// set the appropriate OrderingLink
OrderingLinks.Add ( sl[ii] + '=' + IntToStr ( ii + 1 ) );
end;
sl.Free;
end;
Luc.
russellbelding schrieb:
> I have an "SQL script presenter" that presents in a TIB_GRID the dataYou can use the OrderingItems Property so you can order by any field by
> arriving from an SQL script fed to a TIB_QUERY. I want to allow the
> grid columns to be ordered by clicking on the column titles.
>
> Using a script like "select field01 from table" there is no problem. I
> use grid.gridFields to get fields names like "field01" and feed these
> into the ordering properties of the query.
>
> Using a script like "select field01 as alias01 from table",
> I need "field01" for the query ordering properties. So far I can
> find "alias01" and have not found "field01". Any suggestions as to how
> to find "field01" from the existing grid or query properties or
> methods?
GridTitelClick.
I do something like this in my database browser app:
procedure AddQryOrderFields;
var
ii: Integer;
sl: TStringList;
begin
// Add all query fields to the OrderingItemszulassen
sl := TStringList.Create;
with YourQry do
begin
OrderingItems.Clear;
OrderingLinks.Clear;
// add all query fields to the stringlist
GetFieldNamesList ( sl ); // method of IB_Statement
for ii := 0 to sl.Count - 1 do
begin
// add ordering item for ASCENDIMNG & DESCENDING
OrderingItems.Add ( sl[ii] + '=' + sl[ii] + ';' +
sl[ii] + ' DESC' );
// set the appropriate OrderingLink
OrderingLinks.Add ( sl[ii] + '=' + IntToStr ( ii + 1 ) );
end;
sl.Free;
end;
Luc.