Jump to content

Two table, use one table to find items in other table


This topic is 2350 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I know this can be done, but I am not sure where to begin.  Related Records only give me one item back.

I have:

  • Table 1 has 50 records one field(part #)
  • Table 2 has 10 records one field(part #)

I want to use table 2,10 records to find those records in Table 1.

So in the end, I will be seeing Table 1 with only those found records.  Thus max would be 10 records(if all were found) out of the 50.

:console:

Link to comment
Share on other sites

I don't think your question is clear.

Please do not use an abstract example.  Give your tables and fields meaningful names and explain what they represent and how they are related.

The task you describe is also unclear. What is the real problem you are trying to solve here?

Link to comment
Share on other sites

Fair enough.

  • Attached I have a Database called DATA
  • It has two Tables: 1) NamesTable  2) Lookup
  • What I want to do is have the NamesTable only show those 50 names found within the LookupTable.  Currently, the NamesTable shows 500 names.
  • I do not want to go to the NamesTable and type 50 names into the find dialog box.  There has to be a quick way.

I think I would either need related record here or something with a script and find.

 

Data.fp7

Link to comment
Share on other sites

If you define a relationship between the two tables, matching on last_name, you can then use the Go to Related Record[] script step with the option "Match all records in the current found set" to create a found set of all records in the Data table where last_name matches one of the records in the current found set in the Lookup table.

Note that unlike performing a find, GTRR finds only exact matches. The other alternative is to use a loping script to load the last_name values from the found set in the Lookup table into a variable (or variables), go to the Data table and create a find request for each value.

 

Edited by comment
Link to comment
Share on other sites

This is interesting.  Let do both.  

I have attempted to do both.

Related Record Script--I did a relationship.  I then did a script with related records, but nothing happens.  

Find Records Script-I think I am close on this one.  The only issue is when I run it the find will only bring back one record.  For some reason my loop does not seem to be working.

Thanks for your feedback and help.

Below is my current update file with both of my scripts.

Data.fp7

Edited by chuckcou
Link to comment
Share on other sites

Huh, that is interesting.  I will have a question, but let me see if I can do some leg work to figure out your find request.  P.S.  Thank you.

 

Yes, I am reviewing your script now.^_^  Both work great.  Just working on logic so I can understand

Link to comment
Share on other sites

This topic is 2350 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.