report based on elements are mutually exclusive:

Hi guys,.
I am creating a parameterized report based on elements are mutually exclusive:

I have a list select 'P1_Property_type' element that has these values (office, apartment)
If you choose "desktop" then the report should ONLY the value of the selection list element 'P1_beds '.
If you choose 'apartment' then the report should be considered AS the value of the selection list "P1_size."
----------
I used this query, but it does not seem to contribute:
Select * from realestate where
unit_type = decode (: P1_PROPERTY_TYPE, 'null', unit_type,: P1_property_type)
and
(br = decode (: P1_beds, "null", br,: P1_beds) or size = decode (: P1_size, 'null', size,: P1_size))
----------------
I hope my question is clear

Kind regards
Fateh

Assuming you are using the literal string "null" instead of NULL.

"it doesn't seem to work" because of this:

(br = decode (: P1_beds, "null", br,: P1_beds) or size = decode (: P1_size, 'null', size,: P1_size))

Assuming you choose 'office' and: has the value p1_beds and: p1_size is "null", you end up with a statement that is the equivalent of:

select * from realesate
where unit_type = 'office'
and (br = :p1_beds
or size=size)    <--------------problem

and your: p1_beds restriction is so inefficient.

I'm not a fan of decode for this logic.
I prefer a clear statement of the exclusive predicates that the optimizer can sometimes deal more effectively.

for example, assuming that it is irrelevant, if you choose office or apartment because the relevant parameter: p1_beds or: p1_size will have the appropriate value:

select * from realestate
where
      (:p1.property_type is null / = 'null'
or    (:p1.property_type is not null / != 'null'
and    unit_type          = :p1_property_type))
and   (:p1_beds          is null / = 'null'
or    (:p1_beds          is not null / != 'null'
and    br                 = :p1_beds))
and   (:p1_size          is null / = 'null'
or    (:p1_size          is not null / != 'null'
and    size               = :p1_size))

Note that I have provided alternatives depending on whether you are actually the NULL or a magic string.

Tags: Database

Similar Questions

  • Using SQL to ensure the matching records are mutually exclusive.

    There are two tables defined in the following way:

    Table A

    Number 1

    Number 2

    Date

    ROWID

    Table B

    Number 1

    Number 2

    Date

    Identifier of the line

    Each table stores a call between number 1 and 2 on a specific date. The goal is to map exactly one entry of table A with exactly the record in table B

    in a mutually exclusive way. So a single call to a table must be associated with exactly one call the other table (the key is here

    A.Number1 is B.Number1 and A.Number2 = B.Number2). Because it is a relationship is many to many (the number of source and destination may be paired multiple)

    (time), I'm not able to build a series of sql statements that will allow me to get a relationship one between pairs of telephone numbers.

    I'm not allowed to develop a PL/SQL procedure, which would easily solve this problem.

    I was able to find a solution using MIN(Number 1) KEEP (DENSE_RANK FIRST ORDER BY Date) to THE (PARTITION BY x) the form x

    using temporary tables, which allows me to reach a breaking successively much many relationships (i.e. three broken bones in a 01:58 after

    an iteration, and after one iteration, I arrive at a one to one relationship). However, I can't break these relations some n number of times because it requires number n

    hard curls. Therefore, I need a sophisticated solution that will allow me to achieve a relationship one by one.

    Example of

    Table A

    Record 1

    Number 1:451923456789

    Number 2:541969432045

    Date: 29/07/2015-09:01

    Worksheet 2

    Number 1: 451923456789

    Number 2: 541969432045

    Date: 29/07/2015-09:03

    Table B

    Record 1

    Number 1: 451923456789

    Number 2: 541969432045

    Date: 29/07/2015-09:04

    Worksheet 2

    Number 1: 451923456789

    Number 2: 541969432045

    Date: 29/07/2015-09:05

    If we unite our table A and B by A.Number1 = B.Number1 and A.Number2 = B.Number2, we have 4 records. I'm looking for exactly two records.

    The criteria is to associate by the minimum of the sum of the date of the table A table B date. Therefore, the final result should match:

    (1) record 1 of table A with record 1 of table B.

    sheet 2) 2 table A with 2 record in table B.

    So we must do something to reduce the 4 records resulting from the join of two records describe as we see above.

    The result of the join:

    1st row: TableA.Record1 with TableB.Record1

    2nd place: TableA.Record1 with TableB.Record2

    Rank 3: TableA.Record2 with TableB.Record1

    4th place: TableA.Record2 with TableB.Record2

    What I'm looking for, which is easily achievable with a slider, but not with SQL:

    1st row: TableA.Record1 with TableB.Record1

    4th place: TableA.Record2 with TableB.Record2

    Note that if the minimum date condition allows us to select the necessary records, we won't get the expected results. In other words, using the minimum date.

    the results will be:

    1st row: TableA.Record1 with TableB.Record1

    Rank 3: TableA.Record2 with TableB.Record1

    (criteria - table a minimum date)

    or

    1st row: TableA.Record1 with TableB.Record1

    2nd place: TableA.Record1 with TableB.Record2

    (criteria - date minimum table B)

    Two of these results to break the rule are mutually exclusive.

    Post edited by: 3000640

    If I understand correctly, something like:

    SQL > with tableA (id, telephone1, telephone2, call_date) as)

    2. Select 1, ' 451923456789 ', ' 541969432045',

    3 to_date (July 29, 2015 09:01 ', 'dd.mm.yyyy hh24')

    4 union double all the

    5. Select 2, ' 451923456789 ', ' 541969432045',

    6 to_date (July 29, 2015 09:03 ', 'dd.mm.yyyy hh24')

    double 7),

    TableB 8 (id, telephone1, telephone2, call_date) as)

    9. Select 1, ' 451923456789 ', ' 541969432045',

    10 to_date (July 29, 2015 09:04 ', 'dd.mm.yyyy hh24')

    11 double Union all the

    12. Select 2, ' 451923456789 ', ' 541969432045',

    13 to_date (July 29, 2015 09:05 ', 'dd.mm.yyyy hh24')

    14 double)

    15 select a.id help, a.phone1 aphone1, a.phone2 aphone2,

    16 a.call_date acall_date, b.id offer, b.phone1 bphone1,

    17 b.phone2 bphone2, b.call_date bcall_date

    18 (select id, telephone1, telephone2, call_date,

    19 row_number() over (partition by numbers1, telephone2

    RN 20 order by call_date)

    tablea 21) a

    22 join (select id, telephone1, telephone2, call_date,

    23 row_number() over (partition by numbers1, telephone2

    RN 24 order by call_date)

    tableb 25) b

    26 on a.phone1 = b.phone1 and

    27 a.phone2 = b.phone2 and

    28 a.rn = b.rn;

    HELP APHONE1 APHONE2 ACALL_DATE BPHONE1 BPHONE2 BCALL_DATE OFFERS

    ---------- ------------ ------------ -------------------- ---------- ------------ ------------ --------------------

    1 451923456789 541969432045 July 29, 2015 09:01 1 451923456789 541969432045 July 29, 2015 09:04

    2 451923456789 541969432045 July 29, 2015 09:03 2 451923456789 541969432045 July 29, 2015 09:05

    John

  • A license is required at the VASA? A license is required for each copy? VSI is necessary to have the VASA? They are mutually exclusive? VSI need NOTTM?

    A license is required at the VASA? A license is required for each copy? VSI is necessary to have the VASA? They are mutually exclusive? VSI need NOTTM?

    Thanks in advance.

    Assuming that you are referring to EMC arrays.

    License to the VASA: No.

    VSI required at the VASA: No. they work very well together, but does require that the other.

    VSI allowing VAAI: No. VAAI is active with or without the VSI.

  • Drop-down menus are mutually exclusive

    Hi all:

    I am working on a form in which I need to have a user rates four items 1 to 4 compared to the other. Initially, we were going to use 4 drop downs each menu containing four options allowing the user to choose. The problem is, of course, that the user could choose option 1 four times in a row. So I need a way to allow the user to assess these four points 1 to 4, but in a mutually exclusive way. the image below shows the problem (they are in Spanish, but the text is not important). Here point 1 and section 4 have been selected both as 1, which is what we want to avoid. Any suggestions would be greatly appreciated. Thank you.

    4choices.png

    Hello

    You could have a script of the event preOpen all of the four drop-down menus that would set the display settings, based on the previous selections in the other drop-down menus.

    There is an example here to populate the drop-down menus: http://assure.ly/jcTahK.

    Try this in the DropDownList1 preOpen event:

    Remove the previously selected items

    this.deleteItem (DropDownList2.selectedIndex);

    this.deleteItem (DropDownList3.selectedIndex);

    this.deleteItem (DropDownList4.selectedIndex);

    Hope that helps,

    Niall

  • Revel and iCloud are mutually exclusive?

    I installed Adobe Revel on my iPhone 4 (ios 6.1.3) and now iCloud does not synchronize my photos with my Win7 PC.

    Revel seems to work ok, but I didn't really replace iCloud

    Pete,

    Revel/service app shouldn't have an effect to the iCloud service. Have you tried to sign out and then sign back in to your iCloud service? This happens when you are connected to Revel? Glad to hear that Revel works well for you on your pc.

    Let me know if you have other questions about the use of Revel

    Thank you

    Scott

  • Turn Windows features on or off - games and IE are mutually exclusive?

    When I activate the games help to turn Windows features on or off, IE11 is deleted from my computer and is no longer visible as an option to activate Windows features On or Off.  It is a 2 - day old HP Probook running Windows 7 Professional.

    I need to restore to recover IE11 on my machine.  I did this four times now.  100% reproducible.

    Any ideas?

    Okay, I think that all is well now.

    I turned on the game, uninstalled IE11 from Windows Update and reinstalled IE11 using offline Installer.

    The games and IE11 work.  IE11 appears even to turn features Windows turn on or off.

    Thanks for the help and suggestions!

  • Is there a bug with radiogroup when page elements are more than 100?

    Hello

    I have more than 100 items on one page and in the end there are 6 radiogroups 'yes' or a 'no', the user can select. 'Yes' or 'no' in each radiogroup are mutually exclusive, but the 6 radiogroups are independent of each other. For example:

    RadioGroup #1: Yes no

    RadioGroup #2: Yes No

    RadioGroup #3: Yes no

    RadioGroup #4: Yes no

    RadioGroup #5: Yes no

    RadioGroup #6: Yes no

    It works very well. However, recently, I added more elements to the page. And I realize that the user can select only one answer among all 6 radiogroups, which means that not only the 'yes' and 'no' in each radiogroup to exclude each other, but also the 6 radiogroups are exclusive mutual.

    I have them defined simply as "radiogroup" as follows:

    2812 Radiogroup #1 P20_radiogroup

    2813 Radiogroup #2 P20_radiogroup

    2814 Radiogroup #3 P20_radiogroup

    2815 P20_CHARTAUDITING display text (escape special characters, does not save the State) == > just as a display

    2816 P20_radiogroup Radiogroup #4

    2817 Radiogroup #5 P20_radiogroup

    2818 Radiogroup #6 P20_radiogroup

    I'm on ApEx 3.2 with EPG on Oracle 11 g. Any ideas/suggestions would be greatly appreciated!

    Thank you very much
    Helen

    You can not have more than 100 electronic items on a single page.

    See Re: Question about the message "number of elements exceeds 100 maximum."
    or search the limit of 100 points.

    Gus...

  • Application of mutually exclusive

    Hi all

    Could you please help me in this problem.

    CREATE TABLE TEST_VERSION (VERSION_ID NUMBER, SUBVERSION VARCHAR2 (100));

    insert into TEST_VERSION VALUES(1,null);

    insert into TEST_VERSION VALUES(1,'Alpha');

    insert into TEST_VERSION VALUES(1,'Internal Beta');

    insert into TEST_VERSION VALUES(1,'Technical Preview');

    insert into TEST_VERSION VALUES(1,'RTM');

    insert into TEST_VERSION VALUES(2,null);

    insert into TEST_VERSION VALUES(2,'Alpha');

    insert into TEST_VERSION VALUES(3,'Internal Beta');

    insert into TEST_VERSION VALUES(4,'Technical Preview');

    SELECT * FROM TEST_VERSION;

    Select rules:

    for given version_id:

    (1) if there is a SUBVERSION = 'RTM' or the lines in the game and also a line with SUBVERSION = NULL ignore the

    line with SUBVERSION = NULL, and then select all of the other lines, including RTM

    (2) if there is a SUBVERSION row = NULL and there is no line with SUBVERSION = "RTM" then select all the

    lines, including SUBVERSION = NULL

    In essence, row with SUBVERSION = NULL cannot coexist with SUBVERSION = "RTM" for the same

    version_id. They are mutually exclusive. RTM has a higher priority.

    873797 wrote:

    Ramin thanks for your response.

    Your answer works partially.

    For a = 1, it returns the correct values, removed B = NULL row

    For the test of the ranks, he returned only a single line for a = 2. Rest of the lines for a = 3 and a = 4 has disappeared.

    Hello. Okay, I think that now I understand you. Try

    t (a, b) as)

    Select 1, null of union double all the

    Select 1, 'Alpha' from dual union all

    Select 1, 'Internal Beta' dual Union all

    Select 1, 'Technical Preview' from dual union all

    Select 1, 'RTM' from dual union all

    Select 2, union null value double all the

    Select 2, 'Alpha' from dual union all

    Select 3, 'Internal Beta' dual Union all

    Select option 4, "Technical Preview" of double)

    Select * from)

    Select t.*,

    sum (case when b is null then 1 when b = "RTM" then 1 end) on (partition one) c

    t

    )

    where nvl(b,'-1')! = (case when c = 2 then '-1' another '1' end ')

    ----

    Ramin Hashimzade

  • Updated interactive report based on shuttle Page

    I am trying to create an interactive report based on the selected items in a shuttle service.  On the page there is a page entitled P2_ITEMS element which is a shuttle service.  It displays a list of items for the user to choose and returns the item_id, the primary key of the main table.  I then an interactive report on the same page that displays data for the item_ids selected in the shuttle.  I use the sql query below in my interactive report, but nothing shows up in my report.  How can I get the interactive report to be updated when items are selected in the shuttle?

    Select

    a.date_loaded,

    b.item_type,

    c.Item,

    a.info

    point a, item_type_lookup b, item_name_lookup c,.

    where instr (': ' |: P251_ITEMS |': ',' :'|| a.item_id |': ') > 0

    and a.item_type_id = b.item_type_id

    and a.item_name_id = c.item_name_id;

    Hello

    Please, install application example sample Dynamic Actions. There are exactly what you are looking for (side Server-online shuttle refresh).

    Kind regards

    Pavel

  • How to create a report based on the item selected from the list of selection?

    Hello

    I created a tables_LOV based on:

    Select table_name table_name user_tab_cols r, d

    where column_name like '% _type % '.

    Then I created a ListOfTables page element, display in a selection list and pointing to tables_LOV.

    I run the page, and I can choose the table I want in the drop-down list.

    How to create a report based on the selected element? (ex: select * from selected_table)

    Thanks in advance

    Salah

    Hi Salah,

    Allright, take a look at this page: http://apex.oracle.com/pls/apex/f?p=vincentdeelen:collection_report

    I think that simulates what you are trying to accomplish. I've implemented the simplest method I could think of.

    The report is based on a collection of apex. If you are not familiar with this, you should study the documentation: APEX_COLLECTION

    To recreate my example, you should:

    (1) create a report (interactive) on your collection

    SELECT *
       FROM APEX_collections
     WHERE collection_name = 'MY_COLLECTION'
    

    (2) create a selection list page_item for the tables that you want to display (in my case, this is called "P38_TABLES")

    (3) create a dynamic action that triggers on the evolution of your selection list page_item. Dynamic action must be a parade of PL/SQL procedure the following code:

    declare
      l_query varchar2(4000);
    begin
      l_query := 'select * from '||:P38_TABLES;
      if apex_collection.collection_exists
            ( p_collection_name => 'MY_COLLECTION' )
      then
        apex_collection.delete_collection
          ( p_collection_name => 'MY_COLLECTION' );
      end if;
    
      apex_collection.create_collection_from_query
        ( p_collection_name => 'MY_COLLECTION'
        , p_query           => l_query
        );
    end;
    

    Make sure that you add your page_item 'Page to send items' section.

    (4) add a real extra action that makes an update of the report area.

    Here are two photos describing the da:

    http://www.vincentdeelen.com/images/OTN/OTN_COLLECTION_REPORT_DA1.PNG

    http://www.vincentdeelen.com/images/OTN/OTN_COLLECTION_REPORT_DA2.PNG

    Good luck and greetings,

    Vincent

    http://vincentdeelen.blogspot.com

  • Apex 5, call a modal page, set page elements, in values referenced title page elements are not the same (correct) than the item itself

    Hello

    Apex 5.

    IR (departments) on page 2 I want to open a modal page 3 (classic report) with the detail data (from emp) for a Masters depno via a link on depno column.
    In Page 3, I created two elements P3_DEPNO and P3_DNAME. These elements are defined in modal page 3 of page 2.
    When I do these two visible elements on page 3 I can see, the values are set correct according to the value in column (depno) link on page 2.
    However, I would like to place these element values in the page title of page 3
    Title: PGE for DepNo: & P3_DEPNO., DepName: & P3_DNAME.

    It happens that the values mentioned in the title of the page are not the same (good) as in the items himself.
    Initially, they are NULL. Only when I refresh page 2 the values change but remain the same (last called depno) as long as I'm doing a new refresh of page 2.

    I wonder how I can run to display the values of the correct point in the title of the page corresponding to the values of the correct page element (that I have hidden).

    Y at - it something more to do, or it could be a small bug?

    I've created a little demo app on
    https://Apex.Oracle.com/pls/Apex/f?p=75955:2

    WS: AMLWS001

    Demo/demo (developer is)

    Please see the report 1.

    Thank you in advance!

    André

    Hi andremi,

    andreml wrote:

    Hello

    Apex 5.

    IR (departments) on page 2 I want to open a modal page 3 (classic report) with the detail data (from emp) for a Masters depno via a link on depno column.
    In Page 3, I created two elements P3_DEPNO and P3_DNAME. These elements are defined in modal page 3 of page 2.
    When I do these two visible elements on page 3 I can see, the values are set correct according to the value in column (depno) link on page 2.
    However, I would like to place these element values in the page title of page 3
    Title: PGE for DepNo: & P3_DEPNO, DepName: & P3_DNAME.

    It happens that the values mentioned in the title of the page are not the same (good) as in the items himself.
    Initially, they are NULL. Only when I refresh page 2 the values change but remain the same (last called depno) as long as I'm doing a new refresh of page 2.

    I wonder how I can make it work to display the values of the correct point in the title of the page corresponding to the values point right page (what I have hidden).

    Y at - it something more to do, or it could be a small bug?

    Page title is rendered before the page elements, that is why is not highlighted in your title.

    I don't think directly, we can use the page as a page element value.

    Creates a copy of yours and made the change it new App id - 45390

    There, I created a static area without a model before your report area and put your article into that.

    then displayed title PGE for DepNo: & P3_DEPNO, DepName: & P3_DNAME. for the area of your report.

    Kind regards

    Jitendra

  • Class BOM with mutually exclusive components option: box is protected from update

    Hi all

    Please refer to the following Nomenclature-

    Article A- User item Type: class of Option ATO

    BOM item type: Option class

    Item B- Finished product

    Section C- Finished product

    Nomenclature of point A is twofold - point B and C article.

    Box each other is protected against editing.

    Please let know if BOM above is properly created. If not, please explain how to create a BOM with mutually exclusive elements.

    Kind regards

    Abhishek

    Hi Abhishek,

    This is a planned feature.

    Mutually Exclusive is set to 'class point Option' in the model bill ATO/PTO.

    Extend your example - if you have a point D, as the model which included the Option class point has... then in the Bill to point D, against article A, we would be setting up the "Mutually exclusive" indicator to "Y" to indicate the system to choose the point B or C of the agenda during the configuration of the model.

    I hope this helps.

    Thank you and best regards,

    REDA

  • How to change the report based on users?

    Hi all

    I've created a report based on a table. Based on the users (Administrator, user), I want to change my appearance of report. But users are not available in this table. Users are not available in this area table.Common available.

    Req: If I enter as a user I want to not see that my documents.

    If I enter an admin I want to see all users folders.

    How to solve this problem.

    Please explain in detail.

    Thank you and best regards,

    Rambeau

    Hai raghu, pls mark closed this issue.its as a response!

  • Refresh the report based on the select list item

    Hello world

    Someone has the answer to refresh a report based on an element that I select in a select list? I currently have the item in the list of selection and a report under him I wrote a sql that fills with data. If I choose an article in my select list, I want to change the data in my report. What I have to write separate sqls for each item to be fired or write some type of process. Can someone help me?

    Thank you
    Ryan

    Write directly in the SQL report. Your select list item will be the variable in the SQL.

  • How to create a report based on the selection of a node of a tree

    Hello

    I am new to Oracle Apex and tried to build a tree and also an interactive report based on column empno from emp table.

    I created a tree based on the emp table. Now, I want to see the records in the employee selected in the tree.

    This is the query of the tree:

    Select case when connect_by_isleaf = 1 then 0
    When level = 1 then 1
    of another-1
    end the status,
    level,
    'ENAME' as the title,
    NULL as an icon,
    'EMPNO' as value,
    NULL as ToolTip,
    NULL as link
    of ' #OWNER # '. " EMP.
    Start by "MGR" is nothing
    connect prior "EMPNO" = "MGR".
    siblings arrested by 'ENAME '.

    Can someone tell me step by step how to go from here?

    I tried to follow the thread Re: question of tree but could not understand a lot of it.

    The approach to reload the page and display the report is fairly simple.

  • You start by creating a new page element that will be used to store the selected node ID, for example. P100_SELECTED_NODE (you can do atext element and change hidden once everything works as expected)
  • Change the query of the tree and the link column in the SQL of tree definition to a link to the same
    for example if your page is 100, you'd do the tree node a link to the same page but the value of the P100SELECTED_NODE with id_ of the node selected
    This is done here
    {message: id = 4410987}
    In this case, it would be

    ' f ? p = & APP_ID.: 100 :'|| : APP_SESSION |': P100_SELECTED_NODE :'|| EMPNO as link

    Now when you click on a link to tree node, it would be back to the same page, but set the P100_SELECTED_NODE with the empno of the clicked node.

  • All that's left to do, change your report so that it refers to the new point inorder to filter records for this employee empno i.e

    SELECT ...
      ..
    WHERE empno= :P100_SELECTED_NODE
    

Maybe you are looking for