Linking imported tables with existing id columns

I have a number of csv files that I have imported into Grist. The main file, call it table A already contains fields that contain ids for rows in table B.

Can i somehow use this id to setup references between tables A and B in Grist.

If not can I manually link the tables

I have discovered how to link the tables from the Reference Columns Guide, in the docs. However, I am finding that it isn’t filtering the referenced records. Clicking on a record in Table A, moves the record pointer to the correct record in Table B, but all the other records in Table B are also shown. All the tutorials show the records in Table B being filtered. Do I have a setting wrong somewhere.

I think the structure you have now, after setting up reference columns, is that each record of table A has a reference to one record of table B. So when you click a record in table A, there is one record of table B that makes sense to highlight.

In this case, table B is shown in full, with one record just identified with a little triangle as the “pointed to” record. If you switch the widget type for table B from “Table” to “Card”, then a single card will be shown, just for the selected record.

What’s even more common (and what you probably saw mostly in the documentation) is when a reference goes the other way. E.g. if table A is Authors and table B is Books, and each book has a reference to an author, then linking from A to B will mean that clicking on A should select multiple books. With this direction of linking, table B will filter down to only the selected books, and the others will not be shown.

You can accomplish the same even with your data, even if you have a one-to-one relationship. You just need to create a “reverse reference”, going from B to A. You can do that using a formula column with formula A.lookupRecords(YourRefCol=$id) and type “Reference List” to table A. Once you have that, you’ll see additional linking options, and one of them will filter the referenced records.