Skip to Content
0
Former Member
Jan 21, 2008 at 12:24 PM

Optional parameter in QLD

19 Views

I am designing qld with the following query-

SELECT T0.Father, T0.Code, T3.Dscription, T1.CardCode, T1.CardName, T1.DocNum, T3.DocEntry,

T1.DocDueDate, T3.DocDate, T0.Quantity AS 'BOM Qty',T2.Quantity AS 'PO Qty', T3.Quantity AS

'Receipt Qty',t0.Quantity-t3.Quantity as Balance FROM ITT1 T0 , OPOR T1 INNER JOIN POR1 T2

ON T1.DocEntry = T2.DocEntry, PDN1 T3 WHERE t2.ItemCode=t0.code and t2.DocEntry

=t3.BaseEntry AND t2.LineNum = t3.BaseLine

and t3.InvntSttus = 'O' and T0.Father like '%[%0]' and T1.DocNum = '[% 1]' and

T1.CardName like '%[%2]' and T1.DocDueDate between convert(datetime,'[%3]',112) and

convert(datetime,'[%4]',112)

order by t1.DocNum, t3.DocEntry

I want to make DocNum as optional parameter.But since its data type is numeric I can not use

T1.DocNum='%[%1]'

In this case how can I make this numeric field optional.

Note-The square bracket is replaced by underscore in the above query.For eg,

'%[%1]'='% Opening square bracket % 1 Closing square bracket '