1 2 Previous Next 15 Replies Latest reply: Apr 21, 2014 1:03 AM by J-Oracle RSS

    Referring to Page 0's item value in another page

    J-Oracle

      Apex: 4.2

       

      All,

       

      On my page 0, i gave 2 items. P0_QUESTIONS as a Display Only and P0_OPTIONS as a Radio Button.

      The source for these items are picked from the backend tables based on the :APP_PAGE_ID.

       

      While on Page-1: i chose an option in the radio gorup

       

      If i want to refer the above value in Page 3, how do i do it?

      Since the items are on Page 0, there is not item on P1 to refer..

       

      How do i go about ?

       

      TIA,

      J

        • 1. Re: Referring to Page 0's item value in another page
          fac586

          Global page (formerly Page 0) items are exactly that: global. The value of a global page item is the same irrespective of which page or process is referencing it, and irrespective of the page or process that set it. If the value is set to 10 on submission of page 1, then the value will be 10 if it is then referenced during page show on page 3. If page 3 changes the value to 100, then the value will be 100 when it is next accessed on page 1.

           

          Following normal APEX convention, global page items are referenced using the number of the global page they are created on. So an item on global page 0 is referenced as :P0_ITEM on page 1, and on page 3, and in application process FOO...

          • 2. Re: Referring to Page 0's item value in another page
            J-Oracle

            Thx Fac586 for stopping by...

             

            If i have a summary page and at the end if i want to refer to the value of P0_ITEM on all pages, should i create hidden item P<page_no>_VALUE in respective pages and assign

            :P7_VALUE := :P0_ITEM (while in page 7) ?

            • 3. Re: Referring to Page 0's item value in another page
              fac586

              J wrote:

               

              If i have a summary page and at the end if i want to refer to the value of P0_ITEM on all pages, should i create hidden item P<page_no>_VALUE in respective pages and assign

              :P7_VALUE := :P0_ITEM (while in page 7) ?

              Not clear on what you are trying to do. Explain in more detail, preferably using an example on apex.oracle.com.

              • 4. Re: Referring to Page 0's item value in another page
                J-Oracle

                I 'am developing a simple Exam application.

                 

                I have two tables,

                1) QUESTIONS

                2) OPTIONS

                 

                Each page will have two items. Question (Display Only) and Options (Radio Group).

                At the moment i have two items P0_QUESTION and P0_OPTIONS on the page0.

                 

                The values for the above items will be fetched from the database based on the APP_PAGE_ID.

                 

                But to store the value of P0_OPTION in each page, i will have to create a local item in each page.

                Since there will be many questions, there will be many pages and i would not want to manually create local objects on each page, instead is it possible to create a hidden item dynamically based on the page no ? Or something like an array to store the value ?

                 

                TIA,

                J

                • 5. Re: Referring to Page 0's item value in another page
                  fac586

                  J wrote:

                   

                  I 'am developing a simple Exam application.

                   

                  I have two tables,

                  1) QUESTIONS

                  2) OPTIONS

                   

                  Each page will have two items. Question (Display Only) and Options (Radio Group).

                  At the moment i have two items P0_QUESTION and P0_OPTIONS on the page0.

                   

                  The values for the above items will be fetched from the database based on the APP_PAGE_ID.

                   

                  But to store the value of P0_OPTION in each page, i will have to create a local item in each page.

                  Since there will be many questions, there will be many pages and i would not want to manually create local objects on each page, instead is it possible to create a hidden item dynamically based on the page no ? Or something like an array to store the value ?

                  It's not practical to create an application with a separate page for each question. This type of application can be driven dynamically by data using one question page. Instead of using page 0, create a single question page containing the question and option items (personally I'd use reports rather than items, but that adds more complexity), and another item to store the current question number. Before navigating to the question page for the first time, create three APEX collections. Base two collections on queries to get the questions and options and and a third empty one to store the user responses. On the question page, retrieve the questions and options from the collections instead of the base tables. This ensures that users get consistent sets of questions and options, even if they are being simultaneously modified by other users. Use conditions on the current question number to control the display of Next/Previous/Finish buttons or links; computations conditional on the Next/Previous controls to increment/decrement the current question number; a process to record the user response in the collection; a conditional branch triggered by the Finish control to a final submission page; and an unconditional branch back to the question page to cycle through all of the questions.

                   

                  (This is a good example of an XY Problem. Rather than ask the question "I am developing a simple exam application. How can I implement this in APEX?" before starting, you picked an inappropriate solution and asked questions about the problems that arose in implementing it. You should always include some background to the question, and if unsure about the best approach, describe the requirements, not a proposed solution.)

                  • 6. Re: Referring to Page 0's item value in another page
                    J-Oracle

                    Thx fac for pointing me to apex_collections.

                    let me get back to the books and try that.

                    • 7. Re: Referring to Page 0's item value in another page
                      J-Oracle

                      FAC,

                       

                      How do i get the Next/Previous buttons to do the work? - using dynamic actions ?

                      • 8. Re: Referring to Page 0's item value in another page
                        J-Oracle

                        i have a sample app on apex.oracle.com :

                        *it is not working yet.

                        https://apex.oracle.com/pls/apex/f?p=77079:2

                        • 9. Re: Referring to Page 0's item value in another page
                          fac586

                          J wrote:

                           

                          How do i get the Next/Previous buttons to do the work? - using dynamic actions ?

                          No, keep it simple to start with. Just use standard buttons with Submit Page actions. Use the resulting REQUEST values in process and branch conditions.

                          • 10. Re: Referring to Page 0's item value in another page
                            fac586

                            J wrote:

                             

                            i have a sample app on apex.oracle.com : demo/johnykutty'at'gmail.com/demo

                            *it is not working yet.

                            https://apex.oracle.com/pls/apex/f?p=77079:2

                            Those credentials don't work. What is the workspace?

                            • 11. Re: Referring to Page 0's item value in another page
                              J-Oracle

                              Sorry FAC !! .. it is johnj/demo/demo

                              • 12. Re: Referring to Page 0's item value in another page
                                fac586

                                J wrote:

                                 

                                Sorry FAC !! .. it is johnj/demo/demo

                                The demo user has no access to the application. Edit the user and set User is a developer to Yes in the Account Privileges section.

                                • 13. Re: Referring to Page 0's item value in another page
                                  J-Oracle

                                  Done !!.. made demo as a developer !

                                  • 14. Re: Referring to Page 0's item value in another page
                                    fac586

                                    J wrote:

                                     

                                    i have a sample app on apex.oracle.com : demo/johnykutty'at'gmail.com/demo

                                    *it is not working yet.

                                    https://apex.oracle.com/pls/apex/f?p=77079:2

                                    You were using the wrong computation type for the P2_CURR_QUESTION item. The Static Assignment computation

                                     

                                    :P2_CURR_QUESTION := 1

                                     

                                    caused the P2_CURR_QUESTION value to literally be ':P2_CURR_QUESTION := 1'. When P2_CURR_QUESTION was referenced as a bind variable in the P2_QUESTION item source query

                                     

                                    select c002 from apex_collections where collection_name='QUESTIONS' and n001=:P2_CURRENT_Q

                                     

                                    an exception was raised because ':P2_CURR_QUESTION := 1' cannot be converted to a number. In this case you should have just used the value '1' in the Static Value computation, not the PL/SQL assignment. Refer to the documentation for more information on computation types.

                                     

                                    I have made the changes and additions necessary to get a simple example of this type of application running. I think the underlying data model needs some work. Consider using a more flexible and extensible model like in this example.

                                    1 2 Previous Next