5 Replies Latest reply on Nov 8, 2013 5:08 PM by RobMacy

    Global Variable to Set Field

    RobMacy

      Title

      Global Variable to Set Field

      Post

           Hi, I've set a global variable and then changed to another layout, made a new record, selected the idNumber field, and now I want to set that field to the global variable.  I can set the target Set Field[Tx:PTIdNumber FK] but I don't know how to set it to the global  variable.

           eeeek

           Rob

        • 1. Re: Global Variable to Set Field
          philmodjunk

               If your variable is named $$GlobalVariable, use:

               Set FIeld [ Tx::PTIdNumber FK ; $$GlobalVariable ]

               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: Global Variable to Set Field
            RobMacy

                 Although I think I understand the actual results dont support that.  The button does open a new record but doesnt populate the field with the id number.  Here is a shot of the two scripts

            • 3. Re: Global Variable to Set Field
              RobMacy

                   Whoops, i caught the setFieldByName thing.  It works and you are making my day better every time we speak!!!

              • 4. Re: Global Variable to Set Field
                philmodjunk

                     I would guess that the left hand script is not being performed prior to the right hand script being performed.

                     Try putting all these steps into a single script with the left hand script set up as the first two lines of the script and the right hand script steps listed after them. Then run the script from the PT layout and see what happens.

                     And the go to field step may be removed from the script as it is not needed.

                     I seem to recall an earlier thread where you asked about this. If memory serves correct (and after 50,000+ comments posted here, it may not be correct), I described using a an auto-enter calculation setup on the fk field--which is not the method your are implementing here.

                     If you are using a script to create the new record, using a single script performed by a button click makes more sense.

                • 5. Re: Global Variable to Set Field
                  RobMacy

                       I like the all one button idea.  It would be from pt layout:

                       set the global variable

                       change layouts

                       new record

                       assign global variable to field

                       Thank you!!!!