3 Replies Latest reply: Nov 5, 2013 1:06 PM by Nicolette RSS

    Sequence's nextval in an item

    salute-Salem

      db11gxe , apex 4.0 , firefox 24 ,

      hi all ,

      i have a check box and a number item ,

      what i want is

      when the check box changes , the nextval of the dept_seq sequence is inserted into the number item .

      i created a dynamic action on the check box of type pl\sql and wrote this

      select dept_seq.nextval into :p9_n from dual ;

      page items to submit , p9_n without the colon  .

      but i only can see one number of the sequence when i load the page , and when i check or uncheck the checkbox , i see nothing ??

       

      why ?

      thanks

        • 1. Re: Sequence's nextval in an item
          Nicolette

          Newbi_egy

           

          This is a classic mistake in understanding what is happening.

          When you use a dynamic action of type "Execute PL/SQL" to change the value of an item. You change the session state value of the item. In other words you change the value of the item on the server.

          To change the value of an page item on the client so that you can see the change use a dynamic action of type "Set value".

           

          Nicolette

          • 2. Re: Sequence's nextval in an item
            salute-Salem

            thanks a lot nicolette , it works now , but there is something confusing me , about the server meaning because it is one pc , and i am the server and the client at the same time , but i think the server here means something else ? what is it ?

             

            2- and about the session state value of the item , how it was changed , i think it was null , then it was changed to the sequence value , right ? but why it did not change again when i checked and unchecked the checkbox ?

            • 3. Re: Sequence's nextval in an item
              Nicolette

              Newbi_egy

              newbi_egy wrote:

               

              thanks a lot nicolette , it works now , but there is something confusing me , about the server meaning because it is one pc , and i am the server and the client at the same time , but i think the server here means something else ? what is it ?

              When you are thinking of a server you probably have a physical machine in mind. But that machine is just a very specialized computer that has still software running on it. Now if your database is running on your laptop that same software is running as if the database was running on a physical server. So in this case the server reference the server software and not the machine.

              2- and about the session state value of the item , how it was changed , i think it was null , then it was changed to the sequence value , right ? but why it did not change again when i checked and unchecked the checkbox ?

              Did you reload the page showing the session state. The session state that is shown on that page is the state as it was when that page was rendered.

               

              Nicolette