7 Replies Latest reply: Nov 18, 2013 9:56 AM by Mike Kutz RSS

    Auto generating serial number in report region(line detail) in a master detail form

    AnnMary

      I need help in doing this .

      This is with regards to the report region in the master detail form . I have line details in my report region where in the ITEMS are  SL NO: , ITEM_ID etc . Now I need a way to auto generate the SL NO as and when I add a new row . Meaning to say

                                                                                                                                               ADD ROW

       

      SL NO:
      ITEM ID
      UOMQUANTITYHeader 5
      1
      2
      3

       

       

      so , when I click the ADD ROW

      button, the cursor will be automatically placed in the ITEM ID column, there fore SL NO column should be Auto generated  as 4

      How can I do this .. Please help me do this

        • 1. Re: Auto generating serial number in report region(line detail) in a master detail form
          Ramani_apex

          please visit this thread and it has been answered .please don't changes the functionally in my workspace becoz i referred many places over OTN.

          https://forums.oracle.com/thread/2521256

          • 2. Re: Auto generating serial number in report region(line detail) in a master detail form
            AnnMary

            hi Ramani

            Thank you very much for your response .I think you din get me right. My doubt is or was regarding to the auto generation of the Serial No in the report region of the master detail form. i.e if i have entered a row in the detail region lets say row (1)..which has SLNo:1 ,, now when i press add row button a new row is inserted .My current application works in such a way that i have to manually feed in the SLNO : as 2. All that i need is .when I press the add row button , A new row generates and i want the SlNo colum to be auto generates as 2 etc .. can u help me with this

            • 3. Re: Auto generating serial number in report region(line detail) in a master detail form
              AnnMary

              hi Ramani

              Thank you very much for your response .I think you din get me right. My doubt is or was regarding to the auto generation of the Serial No in the report region of the master detail form. i.e if i have entered a row in the detail region lets say row (1)..which has SLNo:1 ,, now when i press add row button a new row is inserted .My current application works in such a way that i have to manually feed in the SLNO : as 2. All that i need is .when I press the add row button , A new row generates and i want the SlNo colum to be auto generates as 2 etc .. can u help me with this ..

               

              And above all this am a beginner in APEX, am just learning things now !

              • 4. Re: Auto generating serial number in report region(line detail) in a master detail form
                Ramani_apex

                your was asking the apex default functionally. when you create Master /details form that time you can define the trigger/plsql code for auto generate the seq number.

                so you don't need the seq/sl number define in apex page(it will insert to your table).

                if you want live inserting seq number in screen at row level.? you can visit in my workspace and download the copy try in your local instance.

                • 5. Re: Auto generating serial number in report region(line detail) in a master detail form
                  AnnMary

                  I checked with your application.u have a department called RESEARCH and in that u have

                  EMP Detail..

                  now  under this you have ename , job etc ..

                  Now what am asking is  before ename and job etc ..if you had a column called

                  Sl No: its likes this

                   

                                                                                         DELETE CHECKED ROW       ADD ROW                                       

                   

                  Sl No:    ENAME             JOB                  MGR


                  1.           JONES        MANAGER               7839

                   

                  2.           SCOTT         ANALYST             7566

                   

                    ?             FORD          ANALYST              7566

                   

                   

                  now i want to auto generate  the Sl NO: .. I want to know how to do this.. If you can tell me step by step procedure to do this ..i mean like the apex wizard ..eg : edit page -> page rendering ->edit -report region (like wise )

                   

                  • 6. Re: Auto generating serial number in report region(line detail) in a master detail form
                    Ramani_apex

                    Application Builder>Application 112>Page 1 >FORM>Create Master Detail..SELECT DEPT(TABLE) AS MASTER AND SELECT EMP(TABLE) AS CHILS..Define Primary Key  > Custom PL/SQL function FOR each table.

                    DECLARE

                       L_PRIMARY_KEY NUMBER;

                    BEGIN

                       SELECT NVL(MAX(DEPTNO),0) + 1

                       INTO   L_PRIMARY_KEY

                       FROM   DEPT;

                     

                     

                       RETURN L_PRIMARY_KEY;

                    END;

                    finished the steps. run the page the master child form will be shown>edit the child query region>drive the Empno column add new column Sl_number(this is new column to shown in child view).

                    add now row and submit the page.it will insert new row in child table based on the seq value.

                    • 7. Re: Auto generating serial number in report region(line detail) in a master detail form
                      Mike Kutz

                      This may be a late entry, but here goes:

                      If the sequence of numbers is for display purpose only, and the details report is based on a SELECT statement, just use the SQL pseudo-column ROWNUM.

                       

                      example:

                      SELECT ROWNUM as SL_NUM

                        ,ITEM_ID

                      ...

                      FROM DETAILS_TABLE

                      WHERE MASTER_PK_ID = :P7_MASTER_PK_ID

                       

                      Whatever you do, DO NOT try to generate your own Primary Key value.

                       

                      MK