Subject Re: [IBO] Column unknown
Author Helen Borrie
At 12:02 PM 26-11-01 -0600, Jose Gomex wrote:
>I have narrowed the problem... it's the filter in the IBOQuery, when
>Filtered=True I get this error... the filter expression is (TOTAL_FALTANTE
><> 0)
>I have tryed:
>[TOTAL_FALTANTE] <> 0 (as delphi's help says)
>etc. etc. with no luck.

Below is the text of the query as you quoted it originally. If you are using Dialect 3, then the names which you give to computed output columns might be case-sensitive...

However, I suspect that your filtering might be failing because you are trying to apply a WHERE criterion to an aggregated value.

Have you tried

(a) changing your filter text to 'Total_Faltante <> 0' (this would test case-sensitivity)

(b) running this query in IB_SQL as quoted, but adding
(i) AND Total_Faltante <> 0

(ii) HAVING Total_Faltante <> 0

I suspect that, if (a) won't work, then (b)(i) won't work either, and (b)(ii) will. As far as I understand it, Filter actually modifies the WHERE clause and I doubt whether the Filter mechanism can deal with HAVING clauses...


SELECT Pedidos.Pedido , Pedidos.Cliente , PedidosD.Producto,
sum( PedidosD.Cantidad ) as Total_Solicitado ,
um( PedidosD.Cantidad_Surtida ) as Total_Surtido ,
sum( ( PedidosD.Cantidad - PedidosD.Cantidad_Surtida ) ) as Total_Faltante
FROM Pedidos INNER JOIN PedidosD ON ( Pedidos.Pedido = PedidosD.Pedido )
WHERE (( Pedidos.Cancelada ='F' ) AND ( Pedidos.Cliente LIKE :Cliente ) AND
( PedidosD.Producto LIKE :Producto ) AND
(( Pedidos.Fecha_Requerida_Entrega BETWEEN :FIni AND :FFin ) OR
Pedidos.Fecha_Requerida_Entrega IS NULL )))
GROUP BY Pedidos.Pedido, Pedidos.Cliente , PedidosD.Producto;

All for Open and Open for All
InterBase Developer Initiative ยท