2 Replies Latest reply on Jan 8, 2009 8:37 AM by pvhaute

    Run-time creation of record in related table

    pvhaute

      Title

      Run-time creation of record in related table

      Post

      Hi,

       

      By clicking a button on layout X (connected to table X), i want to create a record in a related table Y.

       

      As far as i could find, scripts only allow to create a "New Record/Request" in the active table (=table X, as this one is connected to layout X), but not in another table that i want to define myself.

       

      I have a, probably similar, issue to delete all the records in the found set of this related table Y.

       

      Can anybody help?

       

      Thanks a lot,

      StPeter

        • 1. Re: Run-time creation of record in related table
          Jens Teich
             Set Variable[ $ID ; maintable::ID ]
          Go To Layout[ relatedTableLayout ]
          New Record
          Set Field[ ID_Main ; $ID ]
          Go To Layout[ Original ]

          Jens


          • 2. Re: Run-time creation of record in related table
            pvhaute
              

            Thanks jensteich!

             

            It works (didn't know you could 'go to a layout' without seeing it on the screen) ... but it seems that the program automatically creates a new record in the maintable (table X) as well.

             

            I print the instructions in my script hereafter for your information (although i think it has more to do with relationships).

             

            Any idea about how to solve this as well?

             

            Thanks a lot for the help so far!

            StPeter.

             

            If [p_Muster::M_Rez_ArtNr1 <> 0]

                 Set Variable [$$M_Id; Value:p_Muster::M_Id]

                 Set Variable [$$M_Rez_ArtNr1; Value:p_Muster::M_Rez_ArtNr1]

                 Go to Layout [LayoutObjectNames ("p_Inventory";"dbase")]

                 New Record/Request

                 Set Field [p_Inventory::z_artnr; $$M_Rez_ArtNr1]

                 Set Field [p_Inventory::comment; $$M_Id&" some comment"]

                 Go to Layout ["p_Muster" (p_Muster)]

            End If