Views
Functions to interact with the views of a table.
Get Views
getActiveView
Get the current view, the method return a view object.
Example
const view = base.getActiveView();
output.text(view._id);
output.text(view);
listViews / getViews (deprecated)
Get all the views of the current table, and return all the views in an array
base.listViews(table: Object/String);
Example
const table = base.getTableByName('Table1');
const views = base.listViews(table);
output.text(views.length);
getViewByName
Get a view object via its name, and return a view object.
base.getViewByName(table: Object/String, viewName: String);
Examples
const table = base.getTableByName('Table1');
const view = base.getViewByName(table, 'view 1');
output.text(view.name);
const view = base.getViewByName('Table1', 'view 1');
output.text(view.name);
Add View
addView
Add a view to a table.
base.addView(table: Object/String, viewName: String);
Examples
const table = base.getTableByName('Table1');
base.addView(table, 'view 2');
base.addView('Table1', 'view 2');
Rename View
renameView
Rename a view in the table.
base.renameView(table: Object/String, currentViewName: String, nextViewName: String);
Examples
const table = base.getTableByName('Table1');
base.renameView(table, 'view1', 'view2');
base.renameView('Table1', 'view1', 'view2');
Delete View
deleteView
Delete a view.
base.deleteView(table: Object/String, viewName: String);
Examples
const table = base.getTableByName('Table1');
base.deleteView(table, 'view2');
base.deleteView('Table1', 'view2');