Search

OracleDollars

$FLEX$ and $PROFILES$


What is $FLEX$ and $PROFILES$?

$FLEX$ and $PROFILES$ are Special Variables in oracle Apps environment and are used to hold values at runtime.
Every Oracle Apps technical consultant will be familiar with the term $FLEX$ and $PROFILES$. Whenever we are working with value sets, we will be using both of these for modifying the data fetched, for basing the values of a parameter on the other parameter and also fetching the Profile Option values.
To segregate this based on the functionality
$FLEX$: Used for basing the value of a parameter on another parameter.
$PROFILES$: used for fetching the data stored in the specified profile option value which is currently active.

Where is it used?

Both these variables are used in the Parameter form of a Concurrent Program and are used at the Where Clause window in the value set of Table type.

Syntax:

:$FLEX$.previous_value_set_name
Important:

  • $FLEX$ must always be in capitals.
  • A ‘:’ must precede the declaration of $FLEX$.
  • The previous value set name must have already been assigned and saved on a different parameter.
:$PROFILES$.Profile_option_name

Important:
  • $PROFILES$ must be always in capitals.
  • ‘:’ must always precede the declaration.
  • Profile option name is the Profile Name and not to be confused with the User profile Name.

Some use of the Special Variables are as below:

Pre-Requisites:

Created an Executable and a concurrent program which is registered in the Application Object Library. The Query for the report is as below:

SELECT e.ename, e.empno, e.sal, e.hiredate, e.deptno, d.dname, d.loc
FROM emp e, dept d
WHERE d.deptno = :x_deptno;
The name of the concurrent program is taken as “XX_Checking_flex_and_profile_use”


Scenario 1:

Changing the value of Parameter B based on the Parameter A:
In this, we created two value sets and they are: XX_SCENARIO_1 and XX_Sub1

Steps:

Create the value set XX_SCENARIO_1 using the validation type as ‘Table’.
Create the second value set XX_Sub1 using the validation type as ‘Table’ and in the where clause field specify the following code:
where deptno <= :$FLEX$.XX_SCENARIO_1

Working:

To check the working of this concurrent program, lets submit this


In the picture here, the First parameter contains no value, so the second parameter is disabled as the WHERE clause in value set is equated to NULL, making the field disabled.



When a value is selected in the first parameter, the second parameter gets enabled and when the LOV is clicked, it shows the departments which are in department number 20 and below it, as we have specified <= in the where clause.



Scenario 2:

Use of :$FLEX$ in the default type option of a Parameter form

Steps:

The query used in the Default Value test field is as below: Select dname from dept where deptno =:$FLEX$.XX_SCENARIO_1
Ensure that the default value for the field Department Number is given as SQL Statement.
Select deptno from dept where deptno=20

Working:

Lets submit the concurrent program and check.

Since the default value was given as a SQL statement, the result of that is shown in the first parameter and the second parameter has the value based on the first parameter as specified in the SQL statement.


Scenario 3:

Use of $PROFILES$ in where clause and Default Value. It is done in the same way as is used in $FLEX$.



Modifying the where clause using $PROFILES$ returns Successful upon validation.





Scenario 4:

Use of Parameter name instead of a value set name in the $FLEX$ Special Variable.
Where Clause of the value set of table type using the parameter name.

Reason:
When we provide the name of the value set in $FLEX$ then we will be able to change the value of the parameter which is dependent on it. If the value set is used by more than one parameter then it becomes difficult to get the exact value in the dependent parameter as it will fetch the values based on the last used value of the value set. It could have been last used by the first parameter or any other parameter in the form. To avoid this kind of confusion, the alternative is to provide the name of the Parameter itself in the $FLEX$ variable. No matter how many times the value set is used, if we provide the parameter name, we will get the dependent parameter value based on its parent parameter only. Let me explain this using the pictures below:

Where Clause of the value set of table type using the parameter
name.



The first and third parameter are based on value set names and the second and fourth parameter are based on parameter name. Since the second parameter is not initialized, the third parameter (value set based )is also not initialized.




Since the latest value is from Second parameter, hence the value in third is based on the second parameter. The third value is based on the value of the second parameter and is irrespective of the value set. Shown in the next picture.





Here the third parameter takes the latest value of the value set, hence shows the department name corresponding to that and the fourth parameter values are dependent on the value of the second parameter.







These were some of the basic uses of $FLEX$ and $PROFILES$. Feel free to post your queries and comments on this topic.

17 comments:

Anonymous said...

This link has been very usefull to me..thanks looking fwd for new posts from you

Sarfraz said...

THANKS MATE VERY HELPFUL, WAS EXACTLY WHAT I WAS LOOKING FOR, THOUGH IF YOU COULD HAVE STARTEED THE ILLUSTRATION FROM THE DEFINITION OF THE VALUE SETS IT WOULD HAVE BEEN EVEN BETTER. THANKS ALOT.

Sarfraz said...

THANKS MATE VERY HELPFUL, WAS EXACTLY WHAT I WAS LOOKING FOR, THOUGH IF YOU COULD HAVE STARTEED THE ILLUSTRATION FROM THE DEFINITION OF THE VALUE SETS IT WOULD HAVE BEEN EVEN BETTER. THANKS ALOT.

Unknown said...

Hi this is a very good article. I have used :$FLEX$ for a segment in a flexfield (i.e values of segment2 depends on Segment1). Is there any way to load data from backend because :$FLEX$ will not be available from backend and the api errors out saying "FLEX-ID does not exists".

Chandra R Matta said...

Thanks for nice article on Valuesets.
How can we create conditionally dependant valuesets.
Say suppose if the value of 1st parameter is "20" then only 2nd parameter should be enabled. For all other values it should be greyed out.
Can we do this ?

Anonymous said...

Good Comprehensive article...written keeping beginner in perspective...Really commendable

chowdary said...

thanks for giving the knowledge to us

chowdary said...

its just awesome

Mayuri Bhavnani said...

Superb !!

Anonymous said...

*********************************************************
Google Enter your search terms Submit search form
Tuesday, March 11, 2008
Value Set - NULL valueset

Note that a bind variable, by default, is required; that is, it must have a value for the statement, expression, or user exit which uses it to have meaning. A bind variable can be made optional by using the :NULL suffix; so that if the bind variable is NULL, the segment/parameter using it will be disabled, and its required property (if enabled) will be
ignored. The :NULL suffix is discussed at the end of this section.

:NULL suffix
-------------
Use the :NULL suffix to make your bind variable optional, that is, allow null values. Instead of :block.field, :$PROFILES$.Option_name, or :$FLEX$.Value_set_name, you would use :block.field:NULL, $PROFILES$.Option_name:NULL, or :$Flex$.Value_set_name:NULL, respectively. For example, if your value set name is Car_Maker_Name_Value_Set, you would use
:$FLEX$.Car_Maker_Name_Value_Set:NULL.

avinash said...

fulifHi
I had five parmeters
if 1 parmeter is 'Y' then
2 parmeter should be optional
3 parmeter should be mandatory
if 1 parmeter is 'n'then
2 and 3 parmeter should be in disable mode

himadri said...

I have a requirement where there are two params using same valueset FND_STANDARD_DATE. the params are date from and date to. When these two params are provided I need to find trx_number in between these dates. Hw should I use the $FLEX$?

as of now m using
select trx_number
from ra_customer_trx_all
where creation_date <= :$FLEX$.FND_SRANDARD_DATE;

But using the above I get only value of Date To, How should I use so that both Date from and Date to are used?? Pls Help
--himadri

Anonymous said...

I have a requirement where there are two params using same valueset FND_STANDARD_DATE. the params are date from and date to. When these two params are provided I need to find trx_number in between these dates. Hw should I use the $FLEX$?

as of now m using
select trx_number
from ra_customer_trx_all
where creation_date <= :$FLEX$.FND_SRANDARD_DATE;

But using the above I get only value of Date To, How should I use so that both Date from and Date to are used?? Pls Help
--himadri

===>
According to the use of :$FLEX$.parameter use posted earlier here, probable solution is
select trx_number
from ra_customer_trx_all
where creation_date BETWEEN :$FLEX$. AND :$FLEX$.
;

let me know if not correct.

Thanks

Anonymous said...

select trx_number
from ra_customer_trx_all
where creation_date BETWEEN :$FLEX$.date_from_parameter_name AND :$FLEX$.date_to_parameter_name
;

toppersacaemy said...

hi,
Thanks man its exactly what i want.
thankuuuuuuuuuuuuuuuuuuuu

Anonymous said...

I had used emp table.in that I had used deptno and empno as parameters in procedure.
To use this procedure in the oracle application.
so how can I use deptno parameter mandatory.

Sujit said...

Hi,

Attach different date valuesets(FND_STANDARD_DATE & FND_STANDARD_DATE_2) to both FromDate and ToDate parameter and then use below syntax to access each parameter value in Valueset definition

From Date can be accessed by ":$FLEX$.FND_STANDARD_DATE"
To Date can be accessed by ":$FLEX$.FND_STANDARD_DATE_2"

Hope this helps

Regards
Sujit