Passing Parameter in SQL

Client has shared me a query using which I created a derived table and made few looks for a particular parameter hardcoded in query as where condition and embedded looks into their portal. Issue I am facing now is the query contains parameter hardcoded in query as where condition. But client wants dynamic looks in such a way that whenever a user tries to login into their portal using SSO the parameter based on user login must be applied as a filter and looks should be displayed accordingly.

Hi @Afreen_Peje,

You should look into Looker user attributes …

These allow filtering in your dashboard or directly in the model in order to only show your user a subset of your data …

grtz,
Stijn

Thanks. But it didn’t work for my situation. Do you have some another option.

If you want to guarantee that the use sees only a subset of the date, you can use access_filters in your model. The WHERE clause for each query is based on a user attribute and the user can’t change it. Slightly different use case. Is this what you are trying to do?

1 Like

Thanks @lloydtabb. :grinning: I created user attributes and applied access filter and it is working as explained in your suggested solution. Thanks.
But there is more to it. …

Looks are embedded to third party web portal as private looks, but we are accessing private looks using same looker credential passed through SSO for different users. Requirement is to change looks based on additional parameter passed in URL, while calling looks as session variable, which is based on User. How do I apply this session variable on looks?

Try adding a filter parameter to the Look’s URL. Filters in the url are of the form:

f[<field_name>]=<filter_value>

For example:

https://learn.looker.com/looks/6?f[lesson_2_names.gender]=F