$a_report to refresh a report, but it is not picking up the variable binding

Hello

APEX - Express 4.1.0 Application
Browsers - all
Database - 11g 2

I have a tree on a page region. When a user clicks on a leaf of the tree, I want to be able to use the ID to refresh a report in a different region on the same page

Code for when the user clicks on the map

$('div.tree_li_a').click (function() {}

node_id = $(this).parents('li:first').attr ('id');

If (node_id.substr (0, node_id.indexOf('|')) == 'Y')
{
$s ('P4_SELECTED_VALUE', node_id.substr (node_id.indexOf('|') + 1));
Alert ("value: ' + $v ('P4_SELECTED_VALUE')");
$a_report ('28576803999973770 ',' 1','20 ', ' 20');
$a_report ($v ('P4_REPORT_ID'), '1','20 ', ' 20');
};
});

SQL statement

SELECT *.
PRODS p WHERE PROD_CODE =: P4_SELECTED_VALUE

The problem I have is that when the report is run (I know it's refreshing) the P4_SELECTED_VALUE of the link variable is null.

Pop alert contains the correct value, and when I do the visible P4_SELECTED_VALUE it also contains the value?

Any help is very appreciated

Rob

Rob,

You insert P4_SELECTED_VALUE value in the APEX session before refreshing the report.

Add following the JS function in your page

//insert value into session using JS

function fnSetSessionState(pItem, pValue) {
    var vAjaxDummy = new htmldb_Get(null, $v('pFlowId'), null, 0);
    vAjaxDummy.add(pItem, pValue);
    var vDummy = vAjaxDummy.get();
    vAjaxDummy = null;
}

and your code...

$('div.tree li a').click( function() {

node_id = $(this).parents('li:first').attr('id');

if (node_id.substr(0,node_id.indexOf('|')) == 'Y')
{
$s('P4_SELECTED_VALUE',node_id.substr(node_id.indexOf('|')+1));
alert('Value Set: ' + $v('P4_SELECTED_VALUE'));
fnSetSessionState('P4_SELECTED_VALUE',$v('P4_SELECTED_VALUE'));
//$a_report('28576803999973770','1','20','20');
$a_report($v('P4_REPORT_ID'),'1','20','20');
};
});

That's how I used the version 3.2 or earlier. But now I prefer to use declarative dynamic actions...

Kind regards
Hari

Tags: Database

Similar Questions

Maybe you are looking for