9 Replies Latest reply on Apr 6, 2016 4:17 PM by Mike_Mitchell

    Script (find matching records)

    TobyGross

      I have a field labeled load# then I created a button that triggers a script which is (find matching records) then I specified the load# field,    S works good if your in a record that has a load#125 and I click on that trigger script button it will find the matching record that has the same load#125 but what  I am trying to do is find any matching load in the entire data base,,,,, say if I'm in a record that has a load#122 it will not find the two loads label 125 it seems like it will only find the matching record of the record that your currently in .?

        • 1. Re: Script (find matching records)
          dtcgnet

          Couple of things.

           

          Try not to include anything in your field names that are on this list:

          Field Names.jpg

           

          That part where it says "cannot be easily used in a calculation" is important. Underscore _ is fine, and often used, just try to find a method you like that does NOT include starting names with underscores.

           

          Your button is doing what it should (right now). What it's doing is simply grabbing the value that you have in your load# field, and finding matching records. If you're looking at a record with a load of 122, it'll find all 122's. 125? all 125's. And so on.

           

          Are you wanting to specify a value, then find all values like that? You can find a range (for example, 122...130), or anything greater than 120 (>120) or all sorts of things. What would you most like to be able to do?

          • 2. Re: Script (find matching records)
            erolst

            TobyGross wrote:

            say if I'm in a record that has a load#122 it will not find the two loads label 125

             

            Why do you think it would? Just to state the obvious: 122 ≠ 125

            • 3. Re: Script (find matching records)
              TobyGross

              I would like this button to find any matching record in the entire database in the field Load#

              • 4. Re: Script (find matching records)
                erolst

                Matching what? If you want to find all records where load# isn't empty, try

                 

                Enter Find Mode

                Set Field [ YourTable::load# ; "*" ]

                Perform Find

                 

                but that is not really “matching” …

                • 5. Re: Script (find matching records)
                  TobyGross

                  is it possible to perform the find matching record to the entire database then I would like the result to show any matching number in that field?

                   

                  like if I had two different record with the same load # I want it to display the two records

                  • 6. Re: Script (find matching records)
                    dtcgnet

                    Can you attach a screen shot of your relationship diagram? That would help us all know what might work best for you.

                    • 7. Re: Script (find matching records)
                      erolst

                      Toby –

                       

                      I'm having difficulty understanding your requirement, which may be a failure on my part.

                       

                      1. Find Matching Records by default is performed against all records in the table (though you can opt to either constrain or extend the found set) – not against the entire database, because the specified field “belongs” to a given table, so searching in other tables makes no sense.

                       

                      All matching records will be displayed (which might not be obvious in Form view).

                       

                      TobyGross wrote:

                      like if I had two different record with the same load # I want it to display the two records

                       

                      2. That is exactly what happens when you perform the command/script while you're on one of these two records; so e.g. #125 will find itself and all others #125s, just as you described – but no 122s, which is the correct behaviour.

                      • 8. Re: Script (find matching records)
                        TobyGross

                        When I am in a table view of all my loads I can see that I have two loads with the same number can I somehow configure the find  match to only show the records that have any matching nlumbers in the load field?

                        • 9. Re: Script (find matching records)
                          Mike_Mitchell

                          This may be a problem of terminology. Are you trying to find duplicates? "Matching records" means "any record in this table that has the same value in this field as the current record." Duplicate means "any records in the current table that have more than one record with the same value."

                           

                          If duplicates are what you want, perform a search using the "!" operator.