Subject Re: [IBO] TIBOQuery: Can't get SqlOrder.add to work
Author Helen Borrie
At 11:56 PM 14/12/2007, you wrote:
>I've never used SQLOrder.Add before and I can't understand why this
>SQL will work in my TIBOQuery:
>'ORDER BY docline.ITEM_NO_CHARGE_TO_CLIENT,
>costtype.costtype_sortorder, loc.loc_sortorder, loc.loc_name,
>docline.item_order'
>
>but when I try to use SQLOrder.Add I get the error message shown below
>
>procedure TfrmDocument.qryEstimateDataPrepareSQL(Sender: TObject);
>begin
> with qryEstimateData do
> begin
> //Set the sort order
> SQLOrder.Add('docline.ITEM_NO_CHARGE_TO_CLIENT');
> SQLOrder.Add('costtype.costtype_sortorder');
> SQLOrder.Add('loc.loc_sortorder');
> SQLOrder.Add('loc.loc_name');
> SQLOrder.Add('docline.item_order');
> end;
>end;
>
>ISC ERROR MESSAGE:
>Dynamic SQL Error
>SQL error code = -104
>Token unknown - line 29, column 1
>docline
>
>STATEMENT:
>TIBOInternalDataset:
>"<TApplication>.frmDocument.qryEstimateData.IBOqrqryEstimateData."
>'.
>
>Can anyone suggest why this is not working please?

I notice you don't clear the SQLOrder array before you apply the new ordering criteria. Possibly docline.item_order is already in the array from the previous prepare?

Helen