Subject Re: [IBO] Re: Actual field names
Author Svein Erling Tysvaer
Actually, Russell, Lucas suggestion is what you need (with a slight
twist). Did you know that instead of using

OrderingItems:
MyFieldName=MyFieldName;MyFieldName DESC
OrderingLinks:
MyFieldName=1

you can use

OrderingItems:
1=1;1 DESC
OrderingLinks:
MyAliasName=1

The only thing your users have to learn is to click the mouse button and
IBO does the ordering for you.

Set

russellbelding wrote:
> Hello Luc
> Thanks for your suggestion. What you do is exactly what I am doing.
> Unfortunately GetFieldNamesList (IBO 4.3Aa) (used after a
> query.prepare or after query.active=true) returns field alias names
> when they are used, the same as grid.GridFields.
> So I think I will use SET's suggestion and ask the users to learn a
> little more SQL.
> Thanks, Russell.
>
> --- In IBObjects@yahoogroups.com, Lucas Franzen wrote:
>> 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.