Hi Mike,
I am not sure about your logic, so I will just enclosed it with another Select statement to make it clear to SBO that my 1st column is a key from the OCRD table and need the link button.
SELECT X0.CardCode, X0.CardName, X1.* FROM OCRD X0 JOIN (
Select Distinct T0.CardCode ,T0.CardName ,T0.CreditLine ,T0.Balance ,T0.TotQuotes As [Total Open Quotes]
,T0.DocNum As [Quote No.] ,T0.CreateDate As [Quote Date] ,T0.DocTotal As [Quote Total]
From
(
Select BP.CardCode ,BP.CardName ,BP.CreditLine ,(Sum(Inv.DocTotal - Inv.PaidToDate) OVER(Partition By BP.CardCode)) As Balance
,(Sum(QT.DocTotal) OVER(Partition By BP.CardCode)) As [TotQuotes] ,QT.DocNum ,QT.CreateDate ,QT.DocTotal
From OQUT QT Inner Join OCRD BP On QT.CardCode = BP.CardCode Right Join OINV Inv On BP.CardCode = Inv.CardCode
Where QT.DocStatus = 'O' And CAST(QT.CreateDate As Date) > DATEADD(DD, -230, GETDATE())
) T0 Where T0.[CreditLine] < (T0.Balance + T0.[TotQuotes])
) X1 ON X0.CardCode= X1.CardCode
Order By X0.[CardName], X1.[Quote No.], X1.[Quote Date]
It works on my SBO9 PL10.
If you would want the SQ doc to have the link, you need to do the same way i did with the OCRD.
Regards
Edy