Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 CR to SSRS Expression Help

Author  Topic 

ggarza75
Yak Posting Veteran

50 Posts

Posted - 2012-04-23 : 15:18:10
I'm working on a report and this is the last piece I need to complete it.

In one of the column of the report, the column has this Crystal Report expression.

whileprintingrecords;
stringVar DiscrepencyCodes :="";

if (InStr({VIEW_Creditors.DISCREPENCY CODE},{?Contingent Code}) > 0) then
DiscrepencyCodes := DiscrepencyCodes & trim({?Contingent Code})
else
DiscrepencyCodes := "";

if (InStr({VIEW_Creditors.DISCREPENCY CODE}, {?Unliquidated Code}) > 0) then
DiscrepencyCodes := DiscrepencyCodes & trim({?Unliquidated Code})
else
DiscrepencyCodes := DiscrepencyCodes;

I have no idea how to translate this into SSRS. I only worked with CR for a few months before we moved onto SSRS, so some of the expressions in CR do not make sense to me, just like this one.

Hope someone can help with the little information I provided here.

Thanks!

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-04-23 : 15:24:31
you need to use IIF instead of if else in SSRS

http://msdn.microsoft.com/en-us/library/27ydhh0d(v=vs.71).aspx

Instr is also avaiable on SSRS

http://msdn.microsoft.com/en-us/library/8460tsh1(v=vs.80).aspx

I'm not sure code above is in custom code part or used inside report body in CR (I have not worked with CR)
So in SSRS the corresponding expression if inside body would be

= IIF(Instr(Fields!DISCREPENCY CODE.value,Parameters!Contingent Code.value)>0,true part...,flase part)

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -