0
votes

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
What part of the conversion are you stuck on? May we see your work? - halfer
@halfer Thanks for Correcting my Mistake Sir, I am new to StackOver flow next time I will keep in mind about guideline - Rahul Shukla
@halfer Sir , I need to Convert this Crystal Report formula there are 43 formula like Above and I need to Convert them, So please I am requesting you if you know Something about it ,Please Help me. - Rahul Shukla
Do you already have a SSRS parameter to replace {@PrntStartDate}? Do you know conceptually what this expression is doing? The SSRS equivalent of select case is switch. The equivalent of ToNumber is CInt I think - Nick.McDermaid
How can iDay ever be 1 - 5 if you add 9 to (apparently) a day of the month? - Hannover Fist

1 Answers

0
votes

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)