Use Parameters in SQL Rule

By - Updated May 28, 2015

We can use Kepion UI to get user input and pass them to rule as parameters. In the screenshot below, Category and Brand are parameters of Add Trade Expense rule.

To learn how to define, refer to the Create New Rule section in the Kepion Modeler Guide.

Below I’ll use the CPG Revenue sample application to explain how to use these parameters in queries.

We defined two parameters in Add Trade Spend rule in Financial Trade Spend model, as shown below.

All rule parameters can be found in SQL Server under {Database Name}-> Programmability -> Stored Procedure -> {Rule Name} -> Parameters.

Notice these two parameter’s data type is tLabelSet.  The way to refer to this data type’s value is to use query: SELECT TOP 1 Label FROM {Parameter_Name}.

In this specific example, we can use following queries to get user’s input:

For more details, please review the Add Trade Spend rule in Financial Trade Spend model in CPG Revenue model.