2 Replies Latest reply on Aug 13, 2014 3:14 PM by DavidM.

    Swap data between fields.



      Swap data between fields.


           I would like to be able to swap data between 2 fields.  I am guessing a command button with script would be the solution, but being a novice in FileMaker, I thought I would let some experts guide me on this. I have zero script experience in FileMaker.


           Field1 = "Seller1"  and Field2 = "Buyer1"  after button press:

           Field1 = "Buyer1" and Field2 = "Seller1"

           Thanks for your help,


        • 1. Re: Swap data between fields.

               Been using versions of this code since learning "bubble sort" in (not Visual) BASIC back in the early '80s:

               Set Variable [$Value; value: YourTable::Field1 ]
               Set Field [ YourTable::Field1 ; YourTable::Field2 ]
               Set Field [YourTable::Field2 ; $Value ]

               A common issue for newbies and Set Field:


                    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.

          • 2. Re: Swap data between fields.

                 Thanks, worked like a champ and I am learning how to use scripts.


                 Thanks again,