Using a formula for a parameter

Hi All
New here, and any help is appreciated.
I have a task to modify a report, the report currently passes a parameter to a store proc which is a month + year string (‘DEC2015’).
The problem is that i need to make this report work in a web portal, and the web portal will only pass it a parameter as an integer like this : 201512
I do not have the ability to modify the portal or the stored proc so my only option is to do manipulation withing the report.

My question is, can i have the report accept the integer parameter 201512 and then manipulate it within the report and pass the new version to the stored proc?


urir10 (BOB member since 2015-12-21)

Not without modifying the stored procedure. The proc expects the parameter to be in a specific format. If you send the parameter in a different format then the procedure will fail.

If you’re unable to modify either the portal or the proc then it looks like you need to code a translation layer between what is sent from the portal (201512) to be converted to what’s needed by the proc (DEC2015).


rhinok :us: (BOB member since 2008-07-15)

Thanks for the reply,
I know that in SSRS for example i could use an expression as an input to the parameter. and in that expression i could parse a different parameter.
There is no way of doing that in Crystal?


urir10 (BOB member since 2015-12-21)

That’s essentially what you’d be doing. Taking the value from the web portal then translating it to the value required by the procedure. The challenge is that the procedure is executed code, which has to be executed prior to other Crystal Reports functionality, such as evaluating a parameter. You basically have two choices:

  1. “The Crystal Way” - Create a new, blank report and then embed the existing report into the new report as a subreport. This would require you don’t have any subreports in the existing report already. Then, create a parameter field in the main report, which will accept whatever gets passed in by the portal. Next, create a formula that translates the parameter into the appropriate value. Lastly, link the main report to the procedure in the subreport by linking the formula to the parameter in the subreport. In this method, you’re essentially using a blank report as your translation layer before the stored procedure gets executed.

  2. “The Code Way” - using code in your favorite IDE (.NET, Eclipse, etc…) build a translation layer between the portal and the report that will pass the appropriate value into the procedure.


rhinok :us: (BOB member since 2008-07-15)

Thanks.

I think option 1 will be my choice here, i will try to do that.


urir10 (BOB member since 2015-12-21)