Skip to content

Problem with references

When a table is connected to another table by a reference, the current version takes care of loading the target table first and then the source table. The FK column of the source table is filled with the PK of the target table. Note that the FK is identified by accessing the document structure through the API, and the PK is specified by data2grist configuration file.

This does not work when the specified target table PK does not match the displayed column of the link (as specified through Grist in the source table). In particular, the displayed column (which is normally understood as a PK) is frequently an auto-filled formula column.

Planned improvement:

  • Load target tables normally.
  • When loading a source table (identified by the presence of references):
    • Identify the displayed column (PK in the sense of Grist).
    • Retrieve the already loaded records of the target table.
    • Match target table records with source table records.
    • Fill the FK column of the source table with displayed column data, instead of the original information.
    • Load the source table with FK column fixed.