jbolda / gatsby-source-airtable

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question/feature request: multiple views

robations opened this issue · comments

Is it possible to use multiple views within a table? I have a table with views for upcoming and archived events, but when I add config for both (as below) I get the results for both views mixed together.

                    {
                        baseId,
                        tableName: "Events",
                        tableView: "ArchivedEvents",
                        mapping: {
                            Description: "text/markdown",
                        },
                        tableLinks: ["Location"],
                        separateMapType: true,
                    },
                    {
                        baseId,
                        tableName: "Locations",
                        mapping: {
                            "Image": "fileNode",
                        },
                        tableLinks: ["Events"],
                        separateMapType: true,
                    },

Did I miss something, or is there a way to filter by table view, or create a table alias so I can filter by table?

I could recreate the views by filtering in gatsby, but this is a lot of complication to convert string dates into timestamps, and inject a "current date" variable, compared with using Airtable views.

👋

I would encourage you to check out separateNodeType and associated docs here. I always encourage PRs to help clear up documentation if you find a better way to state it!

I would imagine it will look something like where you would then query for allAirtableArchivedEvents or allAirtableUpcomingEvents.

{
    baseId,
    tableName: "Events",
    tableView: "ArchivedEvents",
    mapping: {
        Description: "text/markdown",
    },
    tableLinks: ["Location"],
    separateMapType: true,
    separateNodeType: true,
    queryName: "ArchivedEvents"
},
{
    baseId,
    tableName: "Locations",
    mapping: {
        "Image": "fileNode",
    },
    tableLinks: ["Events"],
    separateMapType: true,
    separateNodeType: true,
    queryName: "UpcomingEvents"
},

This issue has been automatically marked as stale because it has not had any recent activity for 30 days. It will be closed if no further activity occurs within 7 days. Remove stale label, comment, and/or apply "ongoing issue" label to prevent this from being closed. Thank you for your contributions.

Hey @jbolda, thanks for the response, I somehow didn't get chance to go back and try this yet, but looks like it should do the job 👍