4

I need to use the value of one Select List to populate the value of a second select list, but the items in Select List number two are going to be from a completely different tables depending on what's selected in list number one.

Is there a way I can conditionally populate the second list based on the values from the first? So far, my attempts to put an if statement into an LOV declaration have been unsuccessful...

Oliver
  • 43,366
  • 8
  • 94
  • 151
Sonny Boy
  • 7,848
  • 18
  • 76
  • 104

3 Answers3

3

The syntax to use an IF in an Apex LOV is like this:

IF :P123_CHOICE = 'EMP' THEN
  RETURN
  'SELECT ename d, empno r
   FROM emp';
ELSE
  RETURN
  'SELECT dname d, deptno r
   FROM dept';
END IF;
Tony Andrews
  • 129,880
  • 21
  • 220
  • 259
1
   SELECT ename d, empno r
   FROM emp
   WHERE :P123_CHOICE = 'EMP' 
UNION ALL

SELECT dname d, deptno r
   FROM dept
double-beep
  • 5,031
  • 17
  • 33
  • 41
Juno
  • 11
  • 1
0

I don't know if this is applicable in your case but I have used some APEX_ITEM functions in the past to build dynamic objects. You could look into APEX_ITEM.select_list_from_query for example to create a select list dynamicaly.

Vincent Malgrat
  • 66,725
  • 9
  • 119
  • 171