I’m getting an error when I try to add a calculated field in a BAQ.
Incorrect syntax near the keyword ‘as’.
The SQL looks right to me, but my SQL is rusty.
select
[OrderRel].[OrderNum] as [OrderRel_OrderNum],
[OrderRel].[OrderLine] as [OrderRel_OrderLine],
[OrderRel].[OrderRelNum] as [OrderRel_OrderRelNum],
[OrderDtl].[PartNum] as [OrderDtl_PartNum],
[OrderDtl].[LineDesc] as [OrderDtl_LineDesc],
[OrderDtl].[OrderQty] as [OrderDtl_OrderQty],
[OrderDtl].[CustNum] as [OrderDtl_CustNum],
[OrderDtl].[RequestDate] as [OrderDtl_RequestDate],
[OrderDtl].[NeedByDate] as [OrderDtl_NeedByDate],
(Part.PartNum is null or Part.NonStock = 1) as [Calculated_MakeToOrder] -- ERROR HERE
from Erp.OrderRel as OrderRel
left outer join Erp.JobProd as JobProd on
OrderRel.Company = JobProd.Company
and OrderRel.OrderNum = JobProd.OrderNum
and OrderRel.OrderLine = JobProd.OrderLine
and ( JobProd.JobNum is null )
inner join Erp.OrderDtl as OrderDtl on
OrderRel.Company = OrderDtl.Company
and OrderRel.OrderNum = OrderDtl.OrderNum
and OrderRel.OrderLine = OrderDtl.OrderLine
left outer join Erp.Part as Part on
OrderDtl.Company = Part.Company
and OrderDtl.PartNum = Part.PartNum
where (OrderRel.Make = 1)
Everything else works fine and returns the expected rows. What am I doing wrong with the calculated field?