Search code examples
oracle-apexoracle-apex-5

Oracle APEX- Unable to pass the value into a SQL query on the same page and region using page item


I have been trying to pass the value of a selected row on the interactive grid to an sql query. I was able to set the a page item(p7_ID_CURR) to the current row selected using :

var gridId = "ig-update";
var grid = apex.region( gridId ).widget().interactiveGrid( "getCurrentView");
var model  = grid.model;
var  records = grid.getSelectedRecords();
//console.log(records.length)
var Ids=";";
var currID="";
for(var i=0;i<records.length;i++){
Ids += model.getValue(records[i],"ID")+";";
currID = model.getValue(records[i],"ID");

}

$s("P7_ID_CURR",currID);
$s("P7_ARR_IDS",Ids);

when i reference this page item P7_ID_CURR (text field) in a list item SQL I get a blank value. But I'm able to see the values displayed in the text field.

select value1 D,value2 R
from TABLE1
where ID in (:P7_ID_CURR)

where am I going wrong


Solution

  • Under the select list item's "SQL query" property (which contains that select statement), you'll see the "Cascading list of values" property which lets you enter Parent item(s). Put P7_ID_CURR in there and run the page again.