Jump to content
Keith McKay

Finding records in table a second table

Recommended Posts

Keith McKay    0

I have two tables, A & B, with similar fields.  I want to write a script that will search table B for records that match the fields that are entered in table A.  I am not sure how to do this.  Any suggestions?

Share this post


Link to post
Share on other sites
comment    1,391

Please provide some more details. Why do you need two similar tables? And why wouldn't a relationship work for [whatever it is you're trying to accomplish here]?

Share this post


Link to post
Share on other sites
Lee Smith    147

Hk Keith and welcome to the FM Forums,

Please read the Private Message I sent you.

1 hour ago, Keith McKay said:

I have two tables, A & B, with similar field

Please do not use generic names when referring to you file. The actual names of Fields, Table Occurrences, etc. can be helpful to us in deciphering what your need is.

Lee

Share this post


Link to post
Share on other sites
Keith McKay    0

What I attempting to do is to create an application where items that are for sale are matched up against wanted items.  Instead of having to always do this check manually I thought the computer could do it much more efficiently.  When I enter an item in the For Sale table, the features of the item would be matched against the items in the Wanted table to see if there any matches.  The same process would happen when an item is added to the Wanted table to see if there are any items in the For Sale table.  I didn't know how to implement this in Filemaker and I just assumed that two different tables would be how I should implement it.  I am very open to suggestions.

Share this post


Link to post
Share on other sites
comment    1,391
1 hour ago, Keith McKay said:

I just assumed that two different tables would be how I should implement it.

It really depends on what you eventually intend to do with all this information. But it seems that one table, with a field to distinguish between items wanted and items offered, would be easier to maintain.

In any case, I suspect the matching up would be best done by a relationship - subject to the missing details, like how exactly this needs to work. 

Share this post


Link to post
Share on other sites
Keith McKay    0

If the computer locates a match between a wanted and a for sale item, then I want it to let me know so I can then contact my customer.  Normally, I have to do constant manual checking which is very time consuming.  This way all I have to do is enter the data one time and forget about it until the computer comes up with match.

Share this post


Link to post
Share on other sites
comment    1,391

Yes, but what exactly constitutes a "match"? The devil is in the details. Which "features" do you want to compare, and how tightly each one of them needs to match?  For example, you could specify that the price should match within ± X dollars. Or percent. Or you could assign the items to predefined price brackets and match on that. Or ... And that's just the price.

Share this post


Link to post
Share on other sites
Keith McKay    0

The details that each item can match against will grow over time as will the number and kind of items than can be matched, price being just one of the items.  I want the program to be very dynamic and have the ability to add features for matching over time.  For example, a press has specifications such as tonnage, speed, and stroke length.  I want the ability to add these features on the fly for better matching.  The ability to match within a certain range would be very helpful.  So, if a press is within 95% of the wanted tonnage the match would still notify me.  I want to be able to match against multiple criteria - not just one.

Share this post


Link to post
Share on other sites
comment    1,391
8 minutes ago, Keith McKay said:

I want the program to be very dynamic and have the ability to add features for matching over time.

That could be a problem. Filemaker is not a spreadsheet and it's not very "dynamic" when it comes to adding/removing the properties of a record. What fields do you have in your two tables now?

Share this post


Link to post
Share on other sites
Keith McKay    0

I probably have a 1000 different types of items so the fields will very different.  Does Filemaker have the ability to add a field to a table within a script?

Share this post


Link to post
Share on other sites
comment    1,391
Posted (edited)
1 hour ago, Keith McKay said:

Does Filemaker have the ability to add a field to a table within a script?

That's the right question to ask in the circumstances - and the answer is a resounding no. Filemaker is based on the paradigm of a developer establishing a more or less permanent schema, while users handle only the data.

Now, there are data models to deal with situations like yours - in particular, the Entity–Attribute–Value model. However, that's not something I would recommend for a beginner to try and implement. And that's just to store the data; if you also intend to build a relationship based on user-defined attributes, that's something even an experienced developer would find quite challenging, I think.

 

Edited by comment

Share this post


Link to post
Share on other sites

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


  • Similar Content

    • By DreadDamsel
      Hi. I'm using FMPro 12 Advanced.
      Creating a database for our community centre and I need to add a membership number to contacts - but not all of them.
      I've created a separate table for Membership numbers (as not all contacts will have one, so serial numbers aren't appropriate).
      Each membership has a number of details fields.
      It's probably a REALLY logical and stupid problem I'm batting against - but I need to:
      Select a contact>go to their details>add a membership number (go to a floating window layout, enter the details to the serial-number-derived membership) and have the details including the number show up in a tab on the contact's details layout.
      I've created a relationship between my contacts file and my membership file via the Contact_ID>Contact_ID_fk and have played around with other relationships. 
      I've also created a simple script from a button on the Contacts membership tab to go to the Membership Layout window and create a new record. But it keeps creating a new record in the Contacts, not Membership - even though the relationship only has to create new records in the memberships side.
      I'm now running around in circles - please can anyone help me out here?????
    • By Julio
      Hello,
      I have a weird issue that just started happening when I use the 'Print to PDF' script step in a loop.
      I have a script that passes through and prints out a set of pages. When I use the script Debugger and when I reach the spot I am having issues with, I can see, during the preview, that it is in the correct record; showing the correct page, but once it is done and saved as a PDF, it is showing the first record that was browsed.
       
      I have attached a snapshot of the script I am using.
      If you notice, I have it go to the layout First, Performs a Find based on a Variable - It finds the proper records.
      Then it goes to the first record, (for this example, lets say record # 36)
      Starts a loop and saves the record being browsed to a PDF. Then it moves on to the next record in the found set.
      The Custom Dialog which SHOULD show the next records ID, does not. It still shows record #36.
       
      I have no clue as to why. Even though as I go through each script step and I can visually confirm it is moving to the proper record in the FileMaker client, it does NOT save the proper Record.
       
      If I switch the option on the 'Save Record as PDF' from Current Record, to records being browsed, it saves the proper records to PDFs, but it duplicates them 3 times and does not set the proper page numbers.
       
      Attached is also the end result
      The Observ ID: should be 36, 37, 38 but all three pages stay at 36 showing the exact same record.
       
      Thank you all for your help.
       
       
       
       
       
       
       




    • By dysong3
      I have a number of scripts that have worked perfectly for years in previous versions of FileMaker, however in FMP 15 they causse FM to crash.  They only way I have found to avoid the crash is to use the debugger and to use the "step into" button.  That of course is a very cumbersome workaround. You can see one of the culprits below.  Anyone have any ideas what's wrong here?
       
       

    • By sal88
      Hi all
      We have a web based tickets portal which creates new messages in our filemaker database - this is for customers' use. It does this using the PHP API (the website was developed by a third party). We would like the owners of tickets to be notified when the customer has added a message to one of the tickets that they are in charge of.
      Is there a way for filemaker/filemaker server to trigger a 'send email' script when a new record is created via the web portal? Or would it be simpler for this action to occur on the web side?
      Many thanks
    • By capsprojectos
      Hello,

      I have more than 10k executable files, each EXE export data to a single table, inside of an unique MySQL.

      I created a FM database to manage all data (ODBC), but I didn’t solve how to trigger a script from an external EXE, without looping for new data each minute.

       
      Questions:
      #01: There is way to trigger a script in an open database, without looping ?

      #02: Runtime solutions can be used with parameters?
      My best idea, at this time, is to create a runtime solution and a relationship, and call it from the EXE.  I do think is a "stupid idea" and there must be clever solutions out there.
       
      Thanks for all


       
      INFO: I am using windows 10 | FM Pro 15
×

Important Information

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