[SOLVED] Session variables


#1

Is there any way i can use session variables in metabase as a value for sql expression .


#2

Embed the dashboard in an IFRAME, pass the session variable as a parameter from the holding page.


#3

Thank you …very useful info:grinning:


#4

I got a scenario like i have 3 filters for the dashboard , out of 3 filters , value for the first filter i will set from the session and other two i would like enter it by the user .
How can i achieve this ?
how can i hide the first filter?
for example
country_type=Intl&actvn_span=2018-12-01~2018-12-08&compare_actvn_span=2017-12-01~2017-12-08
for country_type i need to set it from the session value and for actvn_span,compare_actvn_span like to enter by the user

Thanks


#5

When you share the dashboard, you lock the parameter you want to set in code and leave the other parameters editable. That way, only the Editable parameters appear on the dashboard.
image


#6

Ok thanks ,
Then how to set the session variable value to the locked filter ? Value of the locked parameter will change as per the session.

suppose this is my url
http://localhost/dashboard/68?country_type=Intl&actvn_span=2018-12-01~2018-12-08&compare_actvn_span=2017-12-01~2017-12-08

should pass values here ?
var payload = {
resource: { question: 75 },
params: {}
};
Thanks


#7

I’m not about to write this for you.
Metabase doesn’t do parameters on the url. It’s up to you to do that in your code. Then pass it to the embedded dashboard.


#8

Ok Thanks