Thursday, June 26, 2014

Dynamically Enable disable parameters in a concurrent program

We will first define a selection criteria .It will be an independent value set which will have two values.
Depending upon which values we select that particular field will be activated.
Let’s first define a Value Set for selection criteria
Navigate to the following path
System Administrator ApplicationValidationSet



Double click on the set and create a new value set for the selection criteria
Value Set Name- DEMO_SELECTION_CRITERIA
Validation Type -Independent




So once you have specified the size of value set save the changes
Now go back to ApplicationValidationValues




Search for your value set and find it



Once you find the value set add two values to it.
Employee ID and Employee Name




Create a dummy value set for employee id



Create a dummy value set for Employee name



Make sure for the dummy value set you have the validation type set as none.
Now once you have dummy value set ready create two values set for employee id and employee name of table type which will try to fetch the data from the per_all_people_f table.
Create value set for employee name and make it as table type as shown below




In the EDIT INFORMATION section of the above created parameter ‘EMPLOYEE_NAME’ add the logic :$FLEX$. DUMMY_EMPLOYEE_NAME = 'Y'



Test it to validate the query is correct
When I tested I got the below error the reason was that there was a space after :$FLEX$.



Removed the space and retested.



In a similar way now we will create a value set for employee id



In the EDIT INFORMATION section of the above created parameter ‘EMPLOYEE_ID’ add the logic :$FLEX$.DUMMY_EMPLOYEE_ID= 'Y'



Test and save all the changes.
Next is define a concurrent program and use all these value set in there
Go to System AdministratorConcurrentProgramDefine and create a new concurrent program




Define program name, short name and application.
Make sure the Executable in XDODTE and let the other things be the default




Click on parameters and define the value sets you have defined
First is the selection criterion



Next is dummy employee name



Specify Default type as sql statement and select the default value as shown below

SELECT DECODE(:$FLEX$.DEMO_SELECTION_CRITERIA,'Employee Name','Y',NULL) from dual
And make this a hidden parameter. This can be done be deselecting the Display button in the above page.

This Logic will ensure that this dummy parameter will select the value ‘Y’ when the ‘DEMO_SELECTION_CRITERIA’ parameter has a value of ‘Employee Name’. In turn the value of ‘Y’ in this dummy parameter will activate the ‘EMPLOYEE_NAME’ Parameter.

Next add the EMPLOYEE_NAME parameter




We will repeat the same steps for EMPLOYEE_ID we will first add the dummy employee id and then we will add the employee id parameter



Specify Default type as sql statement and select the default value as shown below

SELECT DECODE(:$FLEX$.DEMO_SELECTION_CRITERIA,'Employee ID','Y',NULL) from dual
And make this a hidden parameter. This can be done be deselecting the Display button in the above page.

This Logic will ensure that this dummy parameter will select the value ‘Y’ when the ‘DEMO_SELECTION_CRITERIA’ parameter has a value of ‘Employee ID’. In turn the value of ‘Y’ in this dummy parameter will activate the ‘EMPLOYEE_ID’ Parameter.
NEXT add the EMPLOYEE_ID Parameter.




NEXT IS defining a responsibility to execute this concurrent program.

GO to System administrator responsibility

Go to Security-->Responsibility-->Request

Double click on Request and press ctrl+ f11
This will bring up the following screen
Add a new entry there and select your concurrent program as shown below



Save the changes and switch to Application developer responsibility



Go to ViewRequest



Submit a new request



Select your concurrent program



And a pop up will come up like this



Select From the list of box



Employee Id and you will find that the EMPLOYEE_ID parameter is now activated.



Select Employee Name and you will find that the EMPLOYEE_NAME parameter is activated.



This is how we can dynamically enable and disable parameters in the concurrent program. This is very important when you are creating a report as a lot of requirement comes for enabling and disabling parameters dynamically

No comments: