3 Replies Latest reply on Oct 26, 2013 3:01 AM by Padster

    Find records Using Set Field

    kaiviti

      I am trying to write a script that will use produce a found set in the table "pilotage_ROUTEBUILDER" based on the field "pilotage::routename". I thought I could write a scrip that would use Set Field to place the value of "pilotage::routename" into the search field "pilotage_ROUTEBUILDER::routename". The script so far looks like this:

       

      Go to Layout ["Routebuilder" (pilotage_ROUTEBUILDER)]

      Enter Find Mode []

      Set Field [pilotage_ROUTEBUILDER::routename ; pilotage::routename]

      Perform Find

       

      I have made a match field in both tables using a ficticous value and setting every record with the same value. The relationship between these two tables is now a many to many relationship. I have tried the set field many times and mainly it does nothing and at other times it will paste a value that is not from the field I set it to. I have also tried using a local variable and with the same results. What am I doing wrong?

        • 1. Re: Find records Using Set Field
          erolst

          kaiviti wrote:

          I have made a match field in both tables using a ficticous value and setting every record with the same value.  The relationship between these two tables is now a many to many relationship.

           

          If you need a so-called cartesian relationship, there is an operator for exactly that: the “x”. But this is not a solution to your problem. Also, in Find mode you don't get a value from a regularly stored field at all.

           

          Instead capture the value in the right context and while still in Browse mode (starting from your Pilotage table/layout):

           

          Set Variable [ $routename ; pilotage::routename ]

          Go to Layout ["Routebuilder" (pilotage_ROUTEBUILDER)]

          Enter Find Mode []

          Set Field [pilotage_ROUTEBUILDER::routename ; $routename ]

          Perform Find

          • 2. Re: Find records Using Set Field
            kaiviti

            Thanks erolst,  I have been working on this for two days and everything I tried failed.  I also tried setting a variable exactly as you have and it didn't work.  Then, straight after submiting my post I tried the variable method again and it worked.  I think the reason it didn't work before maybe because I had the relationship set wrong.  I was doing so many things that I don't recal what I was doing.  Just for clarity - does the two tables need to have a relationship for a Set Variable function to work?

            • 3. Re: Find records Using Set Field
              Padster

              The bit that you might be missing, when you are setting the variable, you need to be on a layout where the layout table is "Pilotage". You then set the variable, the move to the layout you want to search one. There doesn't have to be any relationship between the two tables;

               

              Go to Layout ["pilotage" (pilotage)]

              Set Variable [ $routename ; pilotage::routename ]

              Go to Layout ["Routebuilder" (pilotage_ROUTEBUILDER)]

              Enter Find Mode []

              Set Field [pilotage_ROUTEBUILDER::routename ; $routename ]

              Perform Find

               

              Pad