3 Replies Latest reply: Jan 17, 2013 5:29 AM by 714270 RSS

    Back on the Tree Page when click Cancel button on a called Page

    378072
      Hi,

      I am developing an application using Application Express 4.1.1.00.23, I developed a tree similar to APEX Sample Database Application tree (i.e Reports > Product Order Tree).
      When I click on a specific node of the tree it navigates to another page in the existing application (as Sample Database Application tree does).

      Sample Database Application does not return to the called Page (if called from Reports > Product Order Tree).

      I have a requirement to come back on the tree Page when I click Cancel button on a called Page.

      Please advice. Thanks in advance.
        • 1. Re: Back on the Tree Page when click Cancel button on a called Page
          714270
          tnvrahmd wrote:
          Hi,

          I am developing an application using Application Express 4.1.1.00.23, I developed a tree similar to APEX Sample Database Application tree (i.e Reports > Product Order Tree).
          When I click on a specific node of the tree it navigates to another page in the existing application (as Sample Database Application tree does).

          Sample Database Application does not return to the called Page (if called from Reports > Product Order Tree).

          I have a requirement to come back on the tree Page when I click Cancel button on a called Page.

          Please advice. Thanks in advance.
          I am not sure if I am getting the question clearly. Do you mean you want to navigate to the tree page (lets say, page 1) from another page (lets say, page 2) when you hit cancel button on the page 2? If so, you can just specify the page number having the tree (page 1) in the button action of the "Cancel" button on page 2. In case, you wish to set the target page of the cancel button dynamically, you can use a hidden page item or an application item. You can set the value of the page/application item in a on-load page process and then use &ITEM_NAME. in the page field of the button action.
          • 2. Re: Back on the Tree Page when click Cancel button on a called Page
            378072
            Hi Rohit,

            Thanks for the reply. If you look at below query (Sample Application Tree's Query), by clicking on a tree node it opens page 3, 6 or 29 based on link_type = 'M' , "C" , "P" or "O" and url constructed.

            In this case just a tree node gets selected and need to capture page number being called.
            As there are 4 urls and 3 pages being called, How I can capture page being called into hidden or application item,

            Thanks.

            ------------------Tree Query ------------
            with data as (
            select 'M' as link_type,
            null as parent,
            'All Categories' as id,
            'All Categories' as name,
            null as sub_id
            from demo_product_info
            union
            select distinct('C') as link_type,
            'All Categories' as parent,
            category as id,
            category as name,
            null as sub_id
            from demo_product_info
            union
            select 'P' as link_type,
            category parent,
            to_char(product_id) id,
            product_name as name,
            product_id as sub_id
            from demo_product_info
            union
            select 'O' as link_type,
            to_char(product_id) as parent,
            null as id,
            (select c.cust_first_name || ' ' || c.cust_last_name
            from demo_customers c, demo_orders o
            where c.customer_id = o.customer_id
            and o.order_id = oi.order_id ) || ', ordered '||to_char(oi.quantity) as name,
            order_id as sub_id
            from demo_order_items oi
            )
            select case when connect_by_isleaf = 1 then 0
            when level = 1 then 1
            else -1
            end as status,
            level,
            name as title,
            null as icon,
            id as value,
            'View' as tooltip,
            case when link_type = 'M'
            then 'f?p='||:APP_ID||':3:'||:APP_SESSION||'::NO:RIR'
            when link_type = 'C'
            then 'f?p='||:APP_ID||':3:'||:APP_SESSION||'::NO:CIR:IR_CATEGORY:'
            ||name
            when link_type = 'P'
            then 'f?p='||:APP_ID||':6:'||:APP_SESSION||'::NO::P6_PRODUCT_ID:'
            ||sub_id
            when link_type = 'O'
            then 'f?p='||:APP_ID||':29:'||:APP_SESSION||'::NO::P29_ORDER_ID:'
            || sub_id
            else null
            end as link
            from data
            start with parent is null
            connect by prior id = parent
            order siblings by name
            • 3. Re: Back on the Tree Page when click Cancel button on a called Page
              714270
              tnvrahmd wrote:
              Hi Rohit,

              Thanks for the reply. If you look at below query (Sample Application Tree's Query), by clicking on a tree node it opens page 3, 6 or 29 based on link_type = 'M' , "C" , "P" or "O" and url constructed.

              In this case just a tree node gets selected and need to capture page number being called.
              As there are 4 urls and 3 pages being called, How I can capture page being called into hidden or application item,

              Thanks.
              I understand the tree code. But I am not clear on what you mean by "How I can capture page being called into hidden or application item". Do you mean that you need to store the page numbers into a hidden page item? If yes, you can set the value in the URL that you generate in the tree. For example,
               case when link_type = 'M'
                           then 'f?p='||:APP_ID||':3:'||:APP_SESSION||'::NO:RIR:P1_HIDDEN_PAGE_ITEM:'||3
                           when link_type = 'C'
                           then 'f?p='||:APP_ID||':3:'||:APP_SESSION||'::NO:CIR:IR_CATEGORY,P1_HIDDEN_PAGE_ITEM:'||name||','||3
                           when link_type = 'P'
                           then 'f?p='||:APP_ID||':6:'||:APP_SESSION||'::NO::P6_PRODUCT_ID,P1_HIDDEN_PAGE_ITEM:'||sub_id||','||6
                           when link_type = 'O'
                           then 'f?p='||:APP_ID||':29:'||:APP_SESSION||'::NO::P29_ORDER_ID,P1_HIDDEN_PAGE_ITEM:'|| sub_id||','||29
                           else null
                           end as link 
              where P1_HIDDEN_PAGE_ITEM is your page item on the page where you have the tree.

              >
              ------------------Tree Query ------------
              with data as (
              select 'M' as link_type,
              null as parent,
              'All Categories' as id,
              'All Categories' as name,
              null as sub_id
              from demo_product_info
              union
              select distinct('C') as link_type,
              'All Categories' as parent,
              category as id,
              category as name,
              null as sub_id
              from demo_product_info
              union
              select 'P' as link_type,
              category parent,
              to_char(product_id) id,
              product_name as name,
              product_id as sub_id
              from demo_product_info
              union
              select 'O' as link_type,
              to_char(product_id) as parent,
              null as id,
              (select c.cust_first_name || ' ' || c.cust_last_name
              from demo_customers c, demo_orders o
              where c.customer_id = o.customer_id
              and o.order_id = oi.order_id ) || ', ordered '||to_char(oi.quantity) as name,
              order_id as sub_id
              from demo_order_items oi
              )
              select case when connect_by_isleaf = 1 then 0
              when level = 1 then 1
              else -1
              end as status,
              level,
              name as title,
              null as icon,
              id as value,
              'View' as tooltip,
              case when link_type = 'M'
              then 'f?p='||:APP_ID||':3:'||:APP_SESSION||'::NO:RIR'
              when link_type = 'C'
              then 'f?p='||:APP_ID||':3:'||:APP_SESSION||'::NO:CIR:IR_CATEGORY:'
              ||name
              when link_type = 'P'
              then 'f?p='||:APP_ID||':6:'||:APP_SESSION||'::NO::P6_PRODUCT_ID:'
              ||sub_id
              when link_type = 'O'
              then 'f?p='||:APP_ID||':29:'||:APP_SESSION||'::NO::P29_ORDER_ID:'
              || sub_id
              else null
              end as link
              from data
              start with parent is null
              connect by prior id = parent
              order siblings by name