15 November 2009

Region appears after button clicked

Sometimes it is very useful to show report on developed page after some button have been clicked. It will allow page user to access it much faster and decrease amount of processing queries.
Let’s say we have a page with filter and report regions. In filter region we add some text fields and SHOW button. The report based on some SQL query with WHERE part referring to filter fields appears only when button SHOW is clicked.
To do it, go to developer mode and find on your page a branch associated with SHOW button. Go to its details and add request that will be send after submit (e.g. APPLY). Save changes. 

Now go to your report region details and find Conditions segment. Select “PL/SQL Expression” as condition type and enter following code:

:REQUEST = 'APPLY'
OR instr(:REQUEST, 'fsp_sort') > 0
OR instr(:REQUEST, 'pg_R') > 0


Save your report. Now when you enter this page, the report region won’t show. If you click SHOW button, the page will submit and send request APPLY. As APPLY is condition to show report region, it will appear.
The other two conditions are needed to prevent disappearing of report region when you want to sort it or use pagination.

1 comment:

Anonymous said...

Przemysław Staniszewski (Przemek),

what if you have 3,4 regions and you want them to show on each button press. how to save regions. not to lose. now every time i press button i lose region (stays only one for which i press button). please help me if you can..