Using Parameters in Formulas

There are many places that you may want to use parameter fields in formulas. One is in the record selection formula.

As an example, Imagine that you want to have an option in a pick list called “All Regions” because you want users to be able to run the report for all re­gions. The Select or Enter Values to Add list doesn’t contain an “All Regions” item. You must add this value by typing it in the field box above the list and moving it to the Default Values list. Save the parameter.

Now you must write a custom selection formula to tell SCR what to do when users select “All Regions” at the prompt. Another example of using a parameter in a formula involves forecasting sales. A formula that forecasts different percentages in sales increases might read:

(Customer. Last Year’s Sales) * 1.20

To make a “what-lf” type of report, you could replace the 20 percent (1.20) value with a parameter. This would allow users to input the forecast percent­age. First create the parameter. In this example, I created a pick list including descriptions for each percent value. The formula on the report would multiply the last years’ sales field by whatever percent value the user picked at the prompt.

ICustomer.Last Year’s Sates! *? Sales forecast!

To have this parameter print as part of a report subtitle, you could just insert me parameter field onto the report and format it. But this would print the actual default value of the parameter, not the description. So, for a 10 percent increase, the parameter would print “1.10.” To make this print the way I want, which is to print “10% Sales Increase Forecast,” I need another formula.

Using a select case statement, I set the case to all the possible values that users might choose at the prompt.