Looker best practices

Preet Mehta
Mar 2, 2022

How to count the number of views in a model:

  1. Open the project
  2. Click Ctrl+Shift+i (to open the Java console)
  3. Paste the following code and you will be able to see the number of views

Note: Make sure you open all the subfolders so that views are visible in the UI. Only then this shall work

hrefs = document.getElementsByTagName('a');
i = 0;
for(var j=0; j<hrefs.length; j++) {
if (hrefs[j]["href"].includes("view.lkml")){
i++;
}
}
console.log(i);

--

--

Preet Mehta

I work as a Data Analyst with LinkedIn Corporation Inc. Originally from Gujarat, I'm passionate about teaching, networking, and philosophy. I'm 27 years old.