Search code examples
databasefilemaker

Populating a table with fields from two other tables


I have two tables in Filemaker:

  • tableA (which includes fields idA (e.g. a123), date, price) and

  • tableB (which includes fields idB (e.g. b123), date, price).

How can I create a new table, tableC, with field id, populated with both idA and idB, (with the other fields being used for calculations on the combined data of both tables)?


Solution

  • The only way is to script it (for repeating uses) or do it 'manually', if this is an ad-hoc process. Details depend on the situation, so please clarify.

    Update: Sorry, I actually forgot about the question. I assume the ID fields do not overlap even across tables and you do not need to add the same record more than once, but update it instead. In such a case the simplest script would be like that:

    Set Variable[ $self, Get( FileName ) ]
    Import Records[ $self, Table A -> Table C, sync on ID, update and add new ]
    Import Records[ $self, Table B -> Table C, sync on ID, update and add new ]
    

    The Import Records step is managed via rather elaborate dialog, but the idea is that you import from the same file (you can just type file:<YourFileName> there), the format is FileMaker Pro, and then set the field mapping. Make sure to choose the Update matching records and Add remaining records options and select the ID fields as key files to sync by.