Two IF Statements

  • I'm converting a Crystal Report to SSRS. In CR, there's a formula that contains two IF statments, which is the following:

    numberVar myClaimDiff := 0;

    if isNull({VIEW_Creditors.claim_diff_value}) then

    myClaimDiff := 0

    else

    myClaimDiff := {VIEW_Creditors.claim_diff_value};

    if ABS({VIEW_Creditors.POC AMOUNT} - {VIEW_Creditors.SCHEDULED AMOUNT}) > myClaimDiff then

    ({VIEW_Creditors.POC AMOUNT} - {VIEW_Creditors.SCHEDULED AMOUNT})

    else

    0

    I know how to make IIF statements in SSRS and usually it's a nested or a single statement, but this is different than what I'm used to.

    Cant anyone assist on how to translate this to SSRS. Much thanks!

  • DarthBurrito (5/30/2012)


    I'm converting a Crystal Report to SSRS. In CR, there's a formula that contains two IF statments, which is the following:

    numberVar myClaimDiff := 0;

    if isNull({VIEW_Creditors.claim_diff_value}) then

    myClaimDiff := 0

    else

    myClaimDiff := {VIEW_Creditors.claim_diff_value};

    if ABS({VIEW_Creditors.POC AMOUNT} - {VIEW_Creditors.SCHEDULED AMOUNT}) > myClaimDiff then

    ({VIEW_Creditors.POC AMOUNT} - {VIEW_Creditors.SCHEDULED AMOUNT})

    else

    0

    I know how to make IIF statements in SSRS and usually it's a nested or a single statement, but this is different than what I'm used to.

    Cant anyone assist on how to translate this to SSRS. Much thanks!

    I'd nest it, as you suggested. The first "IF" just sets the value for the variable myClaimDiff. I took some liberties with your field names 😀

    =iif((Fields!POC_Amount.Value - Fields!Scheduled_Amount.Value) > iif(isNothing(Fields!ClaimDiff.Value) = true, 0, Fields!ClaimDiff.Value) , (Fields!POC_Amount.Value - Fields!Scheduled_Amount.Value), 0)

    This is totally untested and just off the top of my head.

    [font="Courier New"]Looking for a Deadlock Victim Support Group..[/font]
  • You're right. A friend of mine helped me with this and it was the exact same thing. Thanks!

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

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