5 Replies Latest reply on Jul 23, 2009 10:49 AM by LaRetta_1

    How to add new record in 1 layout

    mayor

      Title

      How to add new record in 1 layout

      Post

      Hello,

       

      I facing a problem how to add new record in 1 layout. FYI, I got 1 layout that

      showing data from 2 tables, research and expenses.

       

      Research ( research_account_no, researcher_name, amount, status ....)

      Expenses (research_account_no, invoice_no, invoice_date ....)

       

      Relational field : research_account_no

       

      One research may has number of expenses. So, I just want to add expenses record

      for existing research data by clicking a button. (no need to enter same research data for second time).

       

      Please advice me to to do that.

       

      TQ

        • 1. Re: How to add new record in 1 layout
          LaRetta_1
            

          Research ( research_account_no, researcher_name, amount, status ....)

          Expenses (research_account_no, invoice_no, invoice_date ....)

           

          Relational field : research_account_no


          Hello Mayor, attach a script such as this to a button above your portal:

           

          Freeze Window

          Set Variable [ $accountNo ; Research::research_account_no ]

          Go To  Layout [ layout based upon Expenses ]

           New Record Request

          Set Field [ Expenses::research_account_no ; $accountNo ]

          Commit Records/Requests

          ... now, you can stay on this  Expenses layout to enter the detail and then have a button to take you back to Research or, what many people do if all the Expense fields are in that portal, is return to the portal to enter the detail.  So to return, finish your script with:

          Go To Layout [ original layout ]

          Go to Portal Row [ Last ]*

          Go to Field [ the field to begin entering data ]

            * this is based upon an unsorted portal

          • 2. Re: How to add new record in 1 layout
            mayor
              

            My layout setting (layout setup) is "showing records from" table Research and I intend

            to add new record for expenses in the same layout. So, I cannot add new record to table expenses.

             

            When I change to "showing records from" table Expenses, Records from research cannot be displayed.

             

            Correct me if I'm wrong. Is we show data from 2 table (research & expenses) in same layout,

            we cannot add new record in expenses if layout setup is set to showing records from Research.

             

            please advice

            • 3. Re: How to add new record in 1 layout
              etripoli
                 You can add records in a *related* table, if that option is checked in the relation between the two tables.  Either place the fields directly in the layout, or create a portal.
              • 4. Re: How to add new record in 1 layout
                LaRetta_1
                   If you would have tried my script, you would have found that it would work.  Most Developers script new records as I've shown but you CAN use the relationship by checking in the relational graph to  'Allow Creation of Related' and then just type into the portal.
                • 5. Re: How to add new record in 1 layout
                  LaRetta_1
                    

                  etripoli wrote: 
                  Either place the fields directly in the layout, or create a portal.

                  Well, placing the related field directly on the layout would not work here because it is indicated that there will be many expense records and a field placed on the layout will only ever show the first one (according to the relationship sort or natural sort order of creation date).  A portal is certainly required no matter how the new record is created.