CR to SSRS Expression Help

  • 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!

  • DarthBurrito (4/23/2012)


    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!

    I am guessing, but here is my best shot.

    InStr({VIEW_Creditors.DISCREPENCY CODE}, {?Unliquidated Code}) this returns a number of the location of {?Unliquidated Code} in {VIEW_Creditors.DISCREPENCY CODE} If the number is greater than zero then the Unliquidated code exists in the discrepancy code if it is zero then it does not. The if statement then returns the Discrepancy code & Unliquidated Code or just the discrepancy code depending on the result. I am not sure why there are 2 if statements with slightly different outputs or how these would work in a single field. Good luck.

  • Daniel Bowlin (4/24/2012)


    DarthBurrito (4/23/2012)


    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!

    I am guessing, but here is my best shot.

    InStr({VIEW_Creditors.DISCREPENCY CODE}, {?Unliquidated Code}) this returns a number of the location of {?Unliquidated Code} in {VIEW_Creditors.DISCREPENCY CODE} If the number is greater than zero then the Unliquidated code exists in the discrepancy code if it is zero then it does not. The if statement then returns the Discrepancy code & Unliquidated Code or just the discrepancy code depending on the result. I am not sure why there are 2 if statements with slightly different outputs or how these would work in a single field. Good luck.

    Thanks, I posted another site and someone else gave me the same answer. Even I'm not understanding what the statements are trying to do. I'm having the duty to migrate Crystal Reports to SSRS and these CR were created by some Ireland company that my company hired many years ago. Some of the statements in CR are very foreign to me and somestimes it's hard to understand what the statement is trying to do. Even harder when the person above you whose been here 10+ doesnt know either.

  • It's actually very easy. It's simply concatenating two conditional expressions together. The SSRS equivalent would be something like the following

    =IIf(InStr(VIEW_Creditors.DISCREPENCY_CODE.value, Parameters!Contingent_Code.value) > 0, Parameters!Contingent_Code.value, "") & IIf(InStr(VIEW_Creditors.DISCREPENCY_CODE.value, Parameters!Unliquidated_Code.value) > 0, Parameters!Unliquidated_Code.value, "")

    It's checking to see if either or both of the contigent code or unliquidated code parameters are contained in the discrepency code field and outputting the matches.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply