1 Reply Latest reply on Apr 23, 2009 4:56 PM by philmodjunk

    Script for Performing a Find in One Table Based on Data in Linked Field in Another Table

    SBAndrew

      Title

      Script for Performing a Find in One Table Based on Data in Linked Field in Another Table

      Post

      Hello:

       

      I cannot seem to figure out the scripting for this (I'm new at this).  Here is the problem:

       

      1. Run a script to pick up field value in open table (field is agreement number) (which is a text field because some are alpha numeric).

      2. Change to a related table and run a find on that value in a linked field also called agreement number.

       

      In other words, I'm looking at a client information table (with agreement number) and I want to switch to invoice table and display those invoices with that agreement number.

       

      Thanks for any help. 

        • 1. Re: Script for Performing a Find in One Table Based on Data in Linked Field in Another Table
          philmodjunk
            

          Have you created a relationship linking the two tables by agreement number? If so, the Go To Related Record script step can bring up what you want. This is a good one to read about in the help file before you try to use it. Also you may need to test for whether a related record exists before using this step if there is any chance that there is no related record.

           

          Here's another approach.

           

          Set variable [$AgreementNo, table1::Agreementnumberfield]

          Go To Layout [Your detail layout]

          Enter find mode [] deselect the pause option

          set field [table2::agreementnumberfield, $agreementNo]

          set error capture [on]

          Perform find []

          Set error capture [off]

          if [get(foundcount) = 0]

            show custom dialog ["record not found"]

          end if