I have a page with a couple of items and a PLSQL Dynamic content.
The Dynamic content, as its name implies generates a bunch of dynamic items, how many and what they are is dynamic, I get them from a table.
Quite a few of them are POPUP_FROM_QUERY items where the QUERY is also taken from a table. This works well for most things, but a few are such that the QUERY references another dynamically generated item(as in, I generate items for dept and for name, you select a dept, the name item only shows names in that dept).
The code looks something like this:
htp.p ((APEX_ITEM.POPUP_FROM_QUERY (p_idx => 2, p_value => '', p_item_id => 'dept_name', p_lov_query => 'SELECT dept department, dept_id id FROM departments WHERE dept_location = ''USA''', p_item_label => 'dept_name')));
htp.p ((APEX_ITEM.POPUP_FROM_QUERY (p_idx => 2, p_value => '', p_item_id => 'emp_name', p_lov_query => 'SELECT emp emp_name, emp_id id FROM employees WHERE department = :dept_name', p_item_label => 'emp_name')));
I only put the relevant lines here, there are actually trios of lines, one with p_idx = 1, and one with p_idx = 4(apparently you need to leave one for the LOV) but these are all display only. When saving I reference them with apex_application.g_f01(i) where you replace 1 for the p_idx.
I have tried replacing the :dept_name with just about everything. apex_application.g_f02(1), dept_name(the p_item_id), g_f02(1), f02(1), f02_0001(when inspecting the item in consol this shows as id). I have tried all these and all these with ':' in front. I have also tried them just included in the parentheses of the select, and by doing 'select ..... where ..= ' || :dept_name || ''''. None of this seems to work, and I couldn't find anything online or within the documentation for APEX_ITEM