Help

Re: How to link one table column to the primary key of another table using the API?

228 0
cancel
Showing results for 
Search instead for 
Did you mean: 
waldgeist
4 - Data Explorer
4 - Data Explorer

I am trying to achieve the following:

  • A "Points" table that stores usernames and points associated with them
  • A "Leaderboard" table that aggregates all points for the users, i.e. sums up the points for each user

I set up the Leaderboard table first where I defined a "Username" field as the primary key and a "Total" field as a number field. Worked fine.

Now I wanted to setup the Points table so a Username field points back to the primary key "Username" of the Leaderboard table, like this:

 

{
    "name": "Points",
    "description": "Points table to track points per user",
    "fields": [
        {
            "name": "Id",
            "type": "singleLineText"
        },
        {
            "name": "Username",
            "type": "multipleRecordLinks",
            "options": {
                "linkedTableId": "tbl..."
            }
        },
        {
            "name": "Points",
            "type": "number",
            "options": {
                "precision": 0
            }
        }
    ]
}

While this sets up a field "Username" as expected and also defines it as a linked field, this field won't point to the Username field of the Leaderboard table, though. The "inverseLinkFieldId" is not the same as the id of the primary key in that table.

What am I doing wrong here?

1 Reply 1

Hm, the "inverseLinkFieldId" returns the field ID of the linked field that got created in "Leaderboard", not the ID of the primary field in "Leaderboard", so that makes sense.  Functionality wise it should be working as expected though and should show you the values from the primary key when records are linked