2 Replies Latest reply on Apr 6, 2011 4:11 PM by PeterDowns

    Copying field content to new layout



      Copying field content to new layout


      Have a layout 'networkAdmin_Library_Add' attached table - 'tblNetworkInitiatives' with a field called niID. I want to copy the contents of the field to a new layout 'networkAdmin_Library_AddBudget' attached table - 'tblNetworkInitiativesBudget' with the same field niID (and paste it)

      Made up a script called AddNIBudget

      Copy [Select; tblNetworkInitiatives::niID]

      Go to Layout ["networkAdmin_Library_AddBudget" (tblNetworkINiativesBudget)]


      Paste [Select; tblNetworkInitiativeBudget::niID]

      Button is located on 'layout networkAdmin_Library_Add'. Click on it goes to other form enters new number in id record field (generates new record) but in the niID field it puts the following error message -  

      Show Custom Dialog [ Message ; Default = "OK" Button 2 = "Cancel" ] 

      If [ Get ( LastMessageChoice ) = 2 ]

      Halt Script

      End If

      Go to Layout [ Ok Layout ]

      When the field does not have focus it puts a ? 

      I have enabled a relationship between niID in both tables and still get the same error.

      Thanks in advance. Any ideas would be great.



        • 1. Re: Copying field content to new layout

          The relationship is not a factor here as your script avoids using any relationship.

          Copy and Paste have several drawbacks and there are better alternatives. One draw back you have identified. If the referenced field is not on the layout and the cursor is not in the field (Paste can select the field for you), the step fails to work. Another draw back is that the copy step replaces any data the user may have copied with the data you are moving from one table to another and this can confuse and irritate your users.

          Use this script instead:

          #must be performed on layout referring to tblNetworkInitiatives
          Set Variable [$ID ; Value: tblNetworkInitiatives::niID ]
          Go to Layout ["networkAdmin_Library_AddBudget" (tblNetworkINiativesBudget)]
          New Record/Request
          Set Field [tblNetworkInitiativeBudget::niID ; $ID]

          • 2. Re: Copying field content to new layout

            Yet again


            thanks heaps works brilliantly