3 Replies Latest reply on Jul 29, 2014 8:16 AM by philmodjunk

    Buttons and relationships

    ErikManau

      Title

      Buttons and relationships

      Post

           I have two tables, both with a field that is called "Name", and the two "name" fields are connected in a relationship. In their relationship I have tucked off the the box with the option "Allow creation of records in this table via this relationship".

           I have made a button that takes me from one of the first table  to the second, and have given the script "Copy "name" " and "Open "second table" ". I want this button to automatically create a new record in the second table, and copy the existing value in "name" from the first table to the second.

           Basically what I want with the button is to automatically create a new record in the second table with the name of the person in the first table. 

            

        • 1. Re: Buttons and relationships
          AmberDavis

               What I would do is use set variable for the "name" you want to copy over. Then use Go to Layout (Whatever you want to go to) and then Set field equal to "name" ,whatever variable you used. Does this help?

          • 2. Re: Buttons and relationships
            FilmUser

                 I think you'll need a script step "New Record/Request" after going to the target table and before Setting the Field.

            • 3. Re: Buttons and relationships
              philmodjunk

                   "allow creation" won't help much for this task.

                   To sum up the posts of others, your script would look something like this:

                   Set Variable [$Name ; Table1::Name ]
                   Go to Layout ["Table2" (Table2) ]
                   New Record/Request
                   Set Field [Table2::Name ; $Name ]

                   Just substitute your table and field names for those used in this example.

                   Note: When Setting up Set Field, there are two Specify buttons that must be clicked. To get Set Field [Table::Field ; Expression], add set field to your script and click the first button (specify target field). Select Table::Field from the list of fields. Do not click the specify button next to the repetition box. Click OK to close this dialog box. Now click the lower specify button (calculated result) and create the expression to the right of the semicolon (;). Do not try to type in the semicolon.