dbTalk Databases Forums  

Search / Find - Records with same value in a field

comp.databases.filemaker comp.databases.filemaker


Discuss Search / Find - Records with same value in a field in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Buckbuck
 
Posts: n/a

Default Search / Find - Records with same value in a field - 08-11-2010 , 05:53 PM






FM8.5

How does one script a find that returns all records in a table with
the same field value as the record currently being browsed? The
records are INVOICES. The field value in this case is a company name
from a CONTACTS table.

I thought Set Field might be the route but I do not know how to get
the current field's value and put it into a find.

Thanks
Matthew

Reply With Quote
  #2  
Old   
Your Name
 
Posts: n/a

Default Re: Search / Find - Records with same value in a field - 08-11-2010 , 08:17 PM






In article
<bcd8b821-798d-44e1-999d-744e6f67032d (AT) p22g2000pre (DOT) googlegroups.com>,
Buckbuck <buck.matthew74 (AT) yahoo (DOT) com> wrote:

Quote:
FM8.5

How does one script a find that returns all records in a table with
the same field value as the record currently being browsed? The
records are INVOICES. The field value in this case is a company name
from a CONTACTS table.

I thought Set Field might be the route but I do not know how to get
the current field's value and put it into a find.
When FileMaker is in Find mode the data from the current record's Fields
(and related record Fields) is no longer accessible. You can still access
data in Global Fields though, which is the best way to achieve what you
want.

First you make a 'copy' of the data from the required Field in a Global
Field (using the Set Field command), then enter Find mode and 'copy' the
data back to the required Field so that FileMaker can perform the Find.
e.g.
Set Field [g_DataToFind; SearchField]
Enter Find Mode [] <--- Make sure NOT to pause or restore requests
Set Field [SearchField; g_DataToFind]
Perform Find [] <--- Make sure NOT to restore requests

The Global Field will of course need to be the same data type as the Field
being searched (i.e. if searching in a Date Field, the Global Field will
also need to be Date type).


Another way is to use the normal Copy and Paste Script commands, BUT that
replaces whatever information the user has put on the system's clipboard
and so can be annoying.


Helpfull Harry )

Reply With Quote
  #3  
Old   
Lynn Allen
 
Posts: n/a

Default Re: Search / Find - Records with same value in a fieldX-TraceApproved - 08-11-2010 , 09:39 PM



On 2010-08-11 15:53:25 -0700, Buckbuck <buck.matthew74 (AT) yahoo (DOT) com> said:

Quote:
FM8.5

How does one script a find that returns all records in a table with
the same field value as the record currently being browsed? The
records are INVOICES. The field value in this case is a company name
from a CONTACTS table.

I thought Set Field might be the route but I do not know how to get
the current field's value and put it into a find.
SInce you're using FM8.5, try this:

Right click in the field. You'll get a contextual drop-down menu.
Select "Find Matching Records." You're done.

No scripting necessary.

If you truly need scripting, set a variable (Set Variable in the script
command list), enter Find Mode, and use Set Field to put the data into
the field. Then perform the find. Use a $variable with a single dollar
sign, that's a script-scope variable that expires after the script
ends, so you don't have to clean up after yourself.

Using global fields is pretty much last century, and really not needed
for finds, anymore.
--
Lynn Allen
--
www.semiotics.com
Member FBA
FM 10 Certified Developer

Reply With Quote
  #4  
Old   
Howard Schlossberg
 
Posts: n/a

Default Re: Search / Find - Records with same value in a field - 08-11-2010 , 10:26 PM



On 8/11/2010 6:17 PM, Your Name wrote:
Quote:
In article
bcd8b821-798d-44e1-999d-744e6f67032d...oglegroups.com>,
Buckbuck<buck.matthew74 (AT) yahoo (DOT) com> wrote:

FM8.5

How does one script a find that returns all records in a table with
the same field value as the record currently being browsed? The
records are INVOICES. The field value in this case is a company name
from a CONTACTS table.

I thought Set Field might be the route but I do not know how to get
the current field's value and put it into a find.

First you make a 'copy' of the data from the required Field in a Global
Field (using the Set Field command), then enter Find mode and 'copy' the
data back to the required Field so that FileMaker can perform the Find.
e.g.
Set Field [g_DataToFind; SearchField]
Enter Find Mode []<--- Make sure NOT to pause or restore requests
Set Field [SearchField; g_DataToFind]
Perform Find []<--- Make sure NOT to restore requests

And of course the other way of doing it is to use script variables
instead of creating a new global field. Similar to what Harry had,
except it would be:

Set Variable [$name; CompanyName]
Enter Find Mode []<--- Make sure NOT to pause or restore requests
Set Field [COmpanyName; $name]
Perform Find []<--- Make sure NOT to restore requests

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg
FM Professional Solutions, Inc. Los Angeles

FileMaker Certified Developer
Associate Member, FileMaker Business Alliance

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.