Help

table.getAllViews()?

Topic Labels: Scripting extentions
694 1
cancel
Showing results for 
Search instead for 
Did you mean: 
kirkbross
5 - Automation Enthusiast
5 - Automation Enthusiast

I know there is getView(‘ViewName’) to retrieve a particuilar view of a table, but what if you don’t know the name of a view, or how many views there are?

Is there a way to fetch ALL the views of a given table? Something like this:

let table = base.getTable("TableName");
let allViews = table.getAllViews(); // something like this?
output.inspect(allViews);

I have a custom Vue app and want to display a table’s records and then populate a navbar with all the views so a user can click links to switch the table view.

1 Reply 1

Once you have a table, there is a views property for that table, which is an array of all views for the table. Here’s the code example from the docs:

// Show an interactive inspector for every view in "Borrower"
let table = base.getTable("Borrower");
for (let view of table.views) {
    output.inspect(view);
}