1 Reply Latest reply on Nov 21, 2014 4:31 PM by Mike_Mitchell

    Search for row that contains portion of a string

    prbsparx

      I am trying to create a script that will auto-fill a Model based on the manufacturer and serial number entered if it exists in the list of models.

       

      Table: Model Lookup

       

      ManufacturerSerial NumberModel
      AppleG3QP

      MacBook Pro (Retina, 15-inch, Mid 2014)

      AppleFD58

      MacBook Pro (Retina, 15-inch, Late 2013)

       

       

      If I have a serial number, "C02MN1JHFD58" I'd like to be able to somehow search the above table, the table find "FD58" and return "MacBook Pro (Retina, 15-inch, Late 2013)"

       

      What is the best way to do this in filemaker? I have the following script:

       

      Set Variable[$Manufacturer; Value:Assets::Manufacturer]

      Set Variable[$SerialNumber; Value:Assets::Serial Number]

      Go to Layout ["Model Lookup" (Model Lookup)]

      Perform FInd[

      Model Lookup::Manufacturer =$Manufacturer

      Model Lookup::Serial Number =*$SerialNumber

      ]

       

      Unfortunately, the *$SerialNumber is exactly opposite of what I'd like to do...I need it to be $SerialNumber = *Model Lookup::Serial Number*

        • 1. Re: Search for row that contains portion of a string
          Mike_Mitchell

          If your "Serial Number" column is always the rightmost 4 characters of the serial number, you can try:

           

          Set Variable [ $SerialNumberAbbr ; Value = Right ( $SerialNumber ; 4 )

          .

          .

          .

          Model Lookup::Serial Number = *$SerialNumberAbbr

          .

          .

          .

           

          HTH

           

          Mike

           

          P.S. As an aside, best practices for this sort of thing dictate using Set Field script steps to set your Find criteria rather than storing them in the Perform Find script step. It makes troubleshooting easier (because the Find criteria are visible to anyone who looks at the script printed or on screen).