5 Replies Latest reply on Mar 19, 2012 6:52 AM by philmodjunk

    Scripting new record generation

    dsr1

      Title

      Scripting new record generation

      Post

      I am probably staring at the solution and just not seeing it. I will need to generate records that have no direct relationship to the current layout.

      For example creating general ledger records, or errlog logging.

      Can someone please point me in the right direction?

       

      Thanks in advance

       

      Peter

        • 1. Re: Scripting new record generation
          philmodjunk

          "no direct relationship"?

          Go To layout [//select layout based on the table]
          New Record/Request

          If there is data in the current record of the current layout that needs to be entered into the new record in the unrelated table, you can use set variable to capture the values before changing layout, then use set field steps to enter those values from the variables into fields in the new record.

          • 2. Re: Scripting new record generation
            dsr1

            Thanks Phil,

            So, does that means that I must display the the target table's layout to generate a new record?

             

            I have been used to coding that process in this fashion, where "Table" in any open table:

             

            BLANK FILE "Table"

            Populate fields

            STORE FILE "Table"

             

            Without changing the current view.

             

            Peter

            • 3. Re: Scripting new record generation
              philmodjunk

              Yes and no. You have to go to that layout, but it need not be visible to the user.

              If you see a visible change in layout, you can start your script with Freeze Window.

              • 4. Re: Scripting new record generation
                dsr1

                Thanks Phil,

                 

                So, in reality I will always be working on "current table", in this respect.

                 

                Peter

                • 5. Re: Scripting new record generation
                  philmodjunk

                  Yes, What layout, current record, found set and sort order is "current" is critical to the way most scripts execute so you have to keep track of what layout you are on as you establish "table occurrence" context by selecting a layout.

                  Each table occurrence is identified as a box in Manage | Database | Relationships. A given table can have many occurrences. Each table occurrence has its own found set, current record and sort order. In Layout setup, you select a table occurrence for a layout by selecting it in the "Show Records From" drop down list. There's a similar control for portals in portal setup.