How to write this Crystal Report formula as an SSRS Expression?

333 Views Asked by At

I want to convert this Crystal formula into SSRS Expression:

Formula:

 numberVar iDay := ToNumber(Right(Cstr({@PrntStartDate}), 2)) + 9;
    select iDay
     case 1 : {wk_TORIO0430_b.AcquisitionAmnt1}
     case 2 : {wk_TORIO0430_b.AcquisitionAmnt2}
     case 3 : {wk_TORIO0430_b.AcquisitionAmnt3}
     case 4 : {wk_TORIO0430_b.AcquisitionAmnt4}
     case 5 : {wk_TORIO0430_b.AcquisitionAmnt5}

How can I write this in SSRS Expression?

1

There are 1 best solutions below

4
On

Not exactly sure what the first line of this is doing as I don't use Crystal Reports myself, but at Nick said in the comments, the select case can be rewritten using a switch statement. A possible solution to fix the first line would be to add a similar statement to a calculated field and using that field in the switch. You'll have to figure out the logic being used for the numberVar iDay line so you can put it in as it should be.

=SWITCH(Fields!iDay.Value = 1, wk_TORIO0430_b.AcquisitionAmnt1,
        Fields!iDay.Value = 2, wk_TORIO0430_b.AcquisitionAmnt2,
        Fields!iDay.Value = 3, wk_TORIO0430_b.AcquisitionAmnt3,
        Fields!iDay.Value = 4, wk_TORIO0430_b.AcquisitionAmnt4,
        Fields!iDay.Value = 5, wk_TORIO0430_b.AcquisitionAmnt5)