Hi
I am creating a SSRS report using RDP. In the report business logic i am trying use a similar sql in the report process method I have a nested case statement in sql which i need to use it in x++. I am trying to do a date diff on two columns from AX tables and comparing the result with custom colum in one of the ax table.. I am using the switch stayements for the case statement but am stuck on the datediff part ...any help on the syntax for the case statement is greatly appreciated!!
select
vps.origpurchid as PO,
vps.Purchaselinelinenumber as Line,
pt.orderaccount as Vendor,
pt.purchname as VendorName,
vps.itemid as Item,
vps.name as Description,
vps.ordered as Ord,
CASE when (
CASE when
(datediff(dd,convert(varchar(10),vps.deliverydate,111), convert(varchar(10),GETDATE(),111)) ) > vt.DELIVERYDATEDAYSTOLERANCE
then '0'
else '1'
end)!=
(case when (vps.ordered/vps.qty) * 100 > (vt.DELIVERYDATEDAYSTOLERANCE)/100
then '0' else '1'
end )then '0' else '1'
end otif
from
[vendpackingsliptrans] vps
join [purchtable] pt
on vps.origpurchid = pt.purchid
join [purchline] pl
on pt.purchid = pl.purchid
join VENDTABLE vt
on pl.VENDACCOUNT = vt.ACCOUNTNUM
*This post is locked for comments