Solved

Strange warnings when using constants in Dashboard LookML

  • 1 November 2021
  • 3 replies
  • 42 views

Hi community! 

 

I’m working on a project using the SA 360 looker block and I’m trying to use constants to make the model used in the dashboards dynamic. I have these strange warnings show up when I replace the code “model:  sa360_block” with “model:  "@{MODEL_NAME}"” in my LookML, even though the value of my constant MODEL_NAME is sa360_block and thus it should not matter for the dashboard whether I write the name of the model or the name of the constant. Am I right in thinking that Looker should treat the code exactly the same as long as the constant MODEL_NAME = sa360_block? 

 

To test it out I built a less complex dashboard and there it worked just fine to use the constant "@{MODEL_NAME}" instead. 

 

Has anyone had issues with this before, or tried to do something similar using the SA 360 looker block?

See below the errors I’m getting all over my dashboard LookML when using the constant instead of just plainly the name. 

 

Would appreciate all input! 

 

/Elin

icon

Best answer by margaret.abercrombie 15 November 2021, 22:23

View original

3 replies

Hi Elin, 

Can you try removing the model from the LookML dashboard filter definition? Looker actually cannot scope a filter to a model, so that parameter doesn’t do anything; I’ve seen the error resolved by removing the model parameter. 

Do keep in mind though, since LookML dashboards cannot scope the filter to a model, the explores used in the filter must be present in all the models the dashboard is included in, otherwise we will get another error. 

Hi Marget!

 

Thank you for your answer,  I removed it from the filter definition and now I’m not getting any errors. However, I want to use constants in the dashboard so I can import the project and change the data source. Now I can do that but not for my filters which is a bit annoying. Do you have a workaround for this issue? 

 

Many thanks,

Elin

Hi Elin, 

The workaround is to make sure the models you include this dashboard in have the appropriate explores for the filter. With that, I also don’t recommend including all dashboards in models (include: *.dashboard) as it does put a bit of a performance toll on your instance, though less so than doing that with views. 
You can use constants on the explores, but Looker currently doesn’t have the functionality to scope filters to models. This would be a good product idea! I recommend submitting your feedback following this process!

Reply