Showing posts with label Enabling/disabling parameters. Show all posts
Showing posts with label Enabling/disabling parameters. Show all posts

Saturday, April 24, 2010

Enabling and disabling parameters dynamically. -2

Here is yet another post on same old topic - "Enabling and disabling parameters dynamically"
Well there is a slight change in requirement.
In my first post on this topic, user have a choice of selecting Yes or No, as a first parameter and based on this first parameter selection, we designed second parameter to behave accordingly.

But, what if there is no selection in first parameter.?
Or in other words, value for first parameter is NULL ?

Brief explanation about the requirement.
My concurrent program has got three parameters as below.
1. Receipt Batch Name
2. GL Date From
3. GL Date To.

Initially, when "Receipt Batch Name"  is NULL then GL Date parameters should be enable and ready to take values.

If a value is entered for "Receipt Batch Name", then GL Date parameters should be disabled.

Simple check to find first parameter as NULL or NOT NULL will not work. For example, consider the code below.
decode(:$FLEX$. XXAR_RECEIPT_BATCH_NAME,NULL,'IT IS NULL','IT IS NOT NULL')
-- this command is not enough.
You need to check for NULL values of any value set like below.
decode(nvl(:$FLEX$.XXAR_RECEIPT_BATCH_NAME:NULL,'X'),'X','Y',null) 


For complete solution, consider following screenshots.






Complete SQL Statement entered as default value is - 
select decode(nvl(:$FLEX$.XXAR_RECEIPT_BATCH_NAME:NULL,'X'),'X','Y',null) from dual











Enter following sql statment in place of  Table Name
(SELECT trunc(SYSDATE) - 1000 + LEVEL date_range FROM DUAL CONNECT BY LEVEL <= 1000) temp_tab













Tuesday, November 10, 2009

Enabling/disabling DATE parameters of a concurrent program

Question: How to enable/disable date parameters of a concurrent program  based on certain condition.?
Answer: Handling number and text parameters had been discussed in the following blogs.
http://apps2fusion.com/at/ar/241-enablingdisabling-concurrent-program-parameters
and one more at http://sureshvaishya.blogspot.com/.

My requirement was different. I wanted to enable/disable DATE parameters based on user input.

Refer to the screenshots to understand what the intended functionality is ..

As shown in the screen, If the value for "Include Manual Invoices" parameter is "Yes", then enable and accept values for  parameters "Invoice Txn Date From" and "Invoice Txn Date To".


If the value for "Include Manual Invoices" parameter is "No", then disable parameters "Invoice Txn Date From" and "Invoice Txn Date To".

Let's get to details, how we can implement the functionality discussed above.

I am not going to discuss other parameters, which are not related to Enabling/disabling - functionality.

Note: As you might have noticed, I intentionally removed/masked custom names while taking screenshots.
Ex: Conc. Program Name, Application Name etc.

Steps:
1. Define controlling parameter, which can be based on any "Yes_or_No" valueset.
In my example - I used valueset called "CST_SRS_SYS_YES_NO".


2. Define parameter - P_HIDDEN_PARAM. As it's name suggests, this is a hidden parameter, which will not be visible when we submit the conc. program.
This parameter is directly dependant on the previous parameter - "Include Manual Invoices"

Set it's Default Type as  "SQL Statement " and
Default value as - "select decode(:$FLEX$.CST_SRS_SYS_YES_NO,'Y','Y',null) from dual".


3. Define custom valueset, which will used for the date parameters - "Invoice Txn Date From" and "Invoice Txn Date To".

- Enter valueset name , Select Format Type as Standard Date. Refer to the screenshot below for other details.

a) Click on Edit Information and enter forllowing query in Table Name field.
(SELECT (TO_DATE (SYSDATE - 200 + LEVEL, 'DD-MON-RRRR')) date_range FROM DUAL CONNECT BY LEVEL <= 1000)temp_tab

I am using "CONNECT BY LEVEL" concept to produce dates with the range of 1000 days.
You can modify 1000 to any other figure as per your requirement.
b) Set Value Name as date_range, which is nothing but the alias name in the query above.
c) Eter following WHERE clause in Where/Order By field.

 WHERE :$FLEX$.AMS_SRS_CHAR1='Y'




4. Attach newly created Value Set for the date parameters - "Invoice Txn Date From" and Invoice "Txn Date To" as shown below.


Save your changes and test it. If you have done all the setups correctly, you will see "Enabling/disabling" functionality something like this..



Write to me if you have any questions.