Home » Developer & Programmer » Application Express & MOD_PLSQL » Display report based on the value picked from select list (Apex 4.1, Oracle 11g)
Display report based on the value picked from select list [message #581624] Tue, 09 April 2013 07:48 Go to next message
inka
Messages: 14
Registered: February 2013
Junior Member
Hello All,

I am using Apex 4.1 and Oracle 11g. I have a form with four fields on it. One of the fields is the select list. I woud like to add the report to this form but only display the values based on the value selected from the select list. How would I do that?
Re: Display report based on the value picked from select list [message #581706 is a reply to message #581624] Wed, 10 April 2013 01:20 Go to previous message
Littlefoot
Messages: 19603
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
If you put (i.e. display) selected items in a text item, you'll see that these values are separated by a colon sign. For example, if return LoV values of the select list item are 1, 2, 3, 4, 5 and you select 1, 3, and 4, the result looks like this: 1:3:4.

It means that you'll have to pass that string to a report and then, in report's query, split that column into rows. For example:
SQL> with test as
  2    (select '1:3:4' col from dual)
  3  select regexp_substr (col, '[^:]+', 1, level) result
  4  from test
  5  connect by regexp_substr (col, '[^:]+', 1, level) is not null;

RESUL
-----
1
3
4

SQL>

Which, finally, means that report's query would look like
select col1, col2, ...
from some_table
where id in (select regexp_substr (:P1_SELECTED_ITEMS, '[^:]+', 1, level) result
             from dual
             connect by regexp_substr (:P1_SELECTED_ITEMS, '[^:]+', 1, level) is not null
            )
Previous Topic: Using the same page for update and insert
Next Topic: How to set-up OHS to connect to the DB(mod_plsql)
Goto Forum:
  


Current Time: Tue Sep 16 15:04:47 CDT 2014

Total time taken to generate the page: 0.08584 seconds