Quantcast
Channel: SQL Server Reporting Services
Viewing all articles
Browse latest Browse all 1418

Need to implement if else condition logic in RDLC report

$
0
0

I have the following query :

select PJ_RetStore_Sales_T.Store_Number, PJ_Location_M.Location, PJ_RetStore_Sales_T.WkEnd_Date, PJ_RetStore_Sales_T.ItemNumber,
 SUM(PJ_RetStore_Sales_T.Qty) as Qty, PJ_Item_M.SellingPrice, sum(PJ_RetStore_Sales_T.Qty)*PJ_Item_M.SellingPrice as total_price,
 PJ_Item_M.RetailPrice,
 sum(PJ_RetStore_Sales_T.Qty)*PJ_Item_M.RetailPrice as total_retail_price
 from PJ_RetStore_Sales_T, PJ_Location_M, PJ_Item_M
 where PJ_RetStore_Sales_T.Store_Number = PJ_Location_M.Store_Number and PJ_RetStore_Sales_T.ItemNumber = PJ_Item_M.ItemNumber
 and PJ_Item_M.variation = 'Std' and WkEnd_Date >= '2002-06-12' and WkEnd_Date <= '2016-06-16'
 and PJ_RetStore_Sales_T.ItemNumber = 'C123'
 group by PJ_RetStore_Sales_T.Store_Number, PJ_Location_M.Location, PJ_RetStore_Sales_T.WkEnd_Date, PJ_RetStore_Sales_T.ItemNumber,
 PJ_Item_M.SellingPrice, PJ_Item_M.RetailPrice order by PJ_RetStore_Sales_T.Store_Number, PJ_RetStore_Sales_T.WkEnd_Date

This retrieves all the values very well .But I also need to implement the below logic while using it in RDLC report. please help me in this:

if-else condition logic:

EndIf((DateTime.Parse(WeekEnd_Date) >= CY_CW_FrmDt) & (DateTime.Parse(WeekEnd_Date) <= CY_ToDate));
     then
	 CY_CW_RtlVal = (CY_CW_RtlVal + round((float.Parse(Sum(PJ_RetStore_Sales__T.Qty) * float.Parse(PJ_Item_M.RetailPrice)), 2));
     T_CY_CW_RtlVal = (T_CY_CW_RtlVal + round((float.Parse(PJ_RetStore_Sales__T.Qty) * float.Parse(PJ_Item_M.RetailPrice)), 2));
EndIf((DateTime.Parse(WeekEnd_Date) >= LY_CW_FrmDt) & (DateTime.Parse(WeekEnd_Date) <= LY_ToDate));
     then
	 LY_CW_RtlVal = (LY_CW_RtlVal + round((float.Parse(PJ_RetStore_Sales__T.Qty) * float.Parse(PJ_Item_M.RetailPrice)), 2));
     T_LY_CW_RtlVal = (T_LY_CW_RtlVal + round((float.Parse(PJ_RetStore_Sales__T.Qty) * float.Parse(PJ_Item_M.RetailPrice)), 2));
EndIf((DateTime.Parse(WeekEnd_Date) >= CY_FromDate) & (DateTime.Parse(WeekEnd_Date) <= CY_ToDate));
     then
	 CY_YTD_RtlVal = (CY_YTD_RtlVal + round((float.Parse(PJ_RetStore_Sales__T.Qty) * float.Parse(PJ_Item_M.RetailPrice)), 2));
     T_CY_YTD_RtlVal = (T_CY_YTD_RtlVal + round((float.Parse(PJ_RetStore_Sales__T.Qty) * float.Parse(PJ_Item_M.RetailPrice)), 2));
EndIf((DateTime.Parse(WeekEnd_Date) >= LY_FromDate) & (DateTime.Parse(WeekEnd_Date) <= LY_ToDate));
     then
	 LY_YTD_RtlVal = (LY_YTD_RtlVal + round((float.Parse(PJ_RetStore_Sales__T.Qty) * float.Parse(PJ_Item_M.RetailPrice)), 2));
     T_LY_YTD_RtlVal = (T_LY_YTD_RtlVal + round((float.Parse(PJ_RetStore_Sales__T.Qty) * float.Parse(PJ_Item_M.RetailPrice)), 2));
 End
     bT_Week_Perc = (((T_CY_CW_RtlVal / T_LY_CW_RtlVal)- 1) * 100);
     bT_YTD_Perc = (((T_CY_YTD_RtlVal / T_LY_YTD_RtlVal)- 1)* 100);

I tried implementing this. The variable names are column names. Please help me in this, how to do it. A code will be better 
 


Viewing all articles
Browse latest Browse all 1418

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>