Tuesday, March 21, 2017

Multi Value Parameter in Concurrent Program

Multi Value Parameter in Concurrent Program


In this article, we shall see a common use-case scenario i.e. Passing multiple values in a single Parameter to concurrent program.

This code can be used as a generic component and can be plugged-in to any concurrent program which requires single parameter which can accept multiple values.

This plug-in includes following:-

1.       Valueset which accepts multiple values separated by comma and enclosed by single quote for concurrent program parameter.

2.       xxxx_rprt_param_util_pkg contains pl/sql stored procedure to parse the comma separated parameter list
This procedure actually tokenizes each value and builds the query dynamically, this will be useful in situations for ex:- in reports where query results depend on values selected and query has to be constructed dynamically. This uses regular expression to validate the parameter to ensure that each value is enclosed with single quote and values separated by comma. For ex:- 'X','Y' is valid whereas 'X','K is not valid.

3.       xxxx_rprt_param_test_pkg contains pl/sql stored procedure which is invoked from concurrent program

STEP1:
We shall first define value set which will accept multiple values enclosed with single quote and separated by comma.
Below are the screenshots of value set definition:-
 

When you click on “edit information”, select event as “Validate” and paste code for function(download the code from link provided at the end of article)
  




STEP2:
Now define Concurrent program executable and concurrent program to test this value set.
Concurrent program excecutable screenshot is:- 
 

Concurrent program definition:-
  



STEP3:

After adding the CP to request group, test your CP.


Report output is


Lets closely see the code executed by CP, as you can see that input parameter is tokenized and final query is formed using xxxx_rprt_param_util_pkg.




Please download the required objects from here.

1 comment: