APEX-AT-WORK no image

APEX Interactive Reports with dynamic filters

Von Tobias Arnhold 10.20.2008
A couple of days ago I worked with dynamic filters in Interactive Reports (In my case: filters which get created at the page start). I used them in pop up pages to show up just a couple of rows depending on the clicked value.

I created an example: http://apex.oracle.com/pls/otn/f?p=28737:4

I must say I couldn't fix that problem myself but with the terrific APEX community I found a solution.
Look at the whole entry: Set Interactive Report in popup with start search value and submit
Thanks again to Andy who made this useful tip possible.

How to do it?
In your pop up site where your Interactive report is go
Home>Application Builder>Application 28737>Page 5>Edit Page> HTML Header
and add this javascript.


<script language="JavaScript" type="text/javascript">

function set_ir_search_val() {
init_gReport();
var v_stop_js = document.getElementById('P5_STOP_JS');
if (v_stop_js.value != 1) {
var v_page = 'P4_SELECT';
var v_from = opener.document.getElementById(v_page);
var v_to = document.getElementById('apexir_SEARCH');
v_to.value = v_from.value;
v_stop_js.value = 1;
gReport.search('SEARCH');
}
}
addLoadEvent(set_ir_search_val);

</script>


Now go Home>Application Builder>Application 28737>Page 5>Edit Region> Region Footer
and add this script:


<script language="JavaScript" type="text/javascript">
set_ir_search_val();
</script>


Finally you need to create a hidden item, in my case: P5_STOP_JS.

I think when you use Interactive Reports a lot then this tip can be really useful for you.

Post Tags:

3 Comments " APEX Interactive Reports with dynamic filters "

Anonymous

Hi Tobias,

That's really a helpful tipp, but some more information how this is working would be nice. I.e. it would be helpful to know if there is an option to select the filtered column and maybe also the operator ( '=', 'contains', 'matches regular expression', ...).

chrissy

Tobias Arnhold 21 November, 2008 07:25

Hi Chrissy!

Thanks for your reply.
It works more or less like a user would be in front of the PC.

1: I load the interactive report
- init_gReport();
2: I set a value in the search field
- var v_to = document.getElementById('apexir_SEARCH');
- v_to.value = v_from.value;
3: I call the IR button to create the rule.
- gReport.search('SEARCH');

To work with columns of the IR or with special operators I haven't tried YET! :(

Greetings,


Tobias

Anonymous

Hi Tobias,

thanks for your explanations. So I will try to get it working with columns and other operators ... When I got it, I'll let you know.

Thanks for your help
chrissy