# Urlparams syntax

**URL:** <https://discuss.elastic.co/t/urlparams-syntax/212891>\
**Category:** Kibana\
**Tags:** canvas\
**Created:** [December 23, 2019, 7:49pm UTC](https://discuss.elastic.co/t/urlparams-syntax/212891 "2019-12-23T19:49:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luis.montecatine](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luis.montecatine/32/48432_2.png) [@luis.montecatine](https://discuss.elastic.co/u/luis.montecatine)\
**Post date:** [December 23, 2019, 7:49pm UTC](https://discuss.elastic.co/t/urlparams-syntax/212891/1 "2019-12-23T19:49:41Z")

</div>

Hello.  
I'm trying to use urlparam on canvas on the "kibana\_sample\_data\_ecommerce" index.  
My param is "dy", and the value is "Tuesday".

When I use on **markdown** the syntax is:  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/3/0/306eaaa7e0447146736e11cc55cab0e34239663b.png)

My problem is when I try to use it on other visualitations, like dropdown filter or metric.  
I'd like to use a urlparam in my query. For example, in a metric, I'd like to get the sum of the field "price" on Tuesdays.  
Probably my syntax is wrong, if someone have some doc about urlparams I'll appreciated.

### For dropdown vis:

It don't shows any data.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/0/e/0e020c5b4006cbe4da01bae4d7533591037c23f1.png)

my elasticsearch query is:  
essql query="SELECT day\_of\_week AS day FROM kibana\_sample\_data\_ecommerce where day='{urlparam param=dy default=Monday}'"  
| dropdownControl valueColumn="day" filterColumn="day"  
| render

If I remove the where condition It works fine anyway:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/1/211ae678362afb7c89e7e1bb3bad6559065d7155.jpeg)

### And for metric vis:

It shows data, It must shows any value\>0  
But it shows 0.

The query preview also shows 0. So I think my syntax is wrong.  
My query is:  
"SELECT sum(products.price) AS price FROM kibana\_sample\_data\_ecommerce where day\_of\_week='{urlparam "dy" default=Monday}' "

Can anyone help me with that or link some documentation about it?

Thanks. Luis.

---

<div class="post-metadata">

**Author:** ![Nathan\_Reese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_reese/32/84829_2.png) [@Nathan\_Reese](https://discuss.elastic.co/u/Nathan_Reese)\
**Post date:** [December 27, 2019, 12:35pm UTC](https://discuss.elastic.co/t/urlparams-syntax/212891/2 "2019-12-27T12:35:13Z")

</div>

Here is all I could find on `urlparam`

> **[Canvas function reference | Kibana Guide \[8.11\] | Elastic](https://www.elastic.co/guide/en/kibana/current/canvas-function-reference.html#urlparam_fn)**

> [@Global Variables in Canvas](https://discuss.elastic.co/t/global-variables-in-canvas/169871/3):
>
> @JamesNotJamez There's not a way to create a "global" value directly, but you could perhaps use the urlparam function as a substitute here. That function allows you to read a value from query params in the URL. When you have a workpad open, the URL in your browser should look something like this: http://localhost:5601/app/canvas#/workpad/... You can add query params before the # in there, like so: http://localhost:5601/app/canvas?target=5000#/workpad/ So now you have a query param named targ…

> [@Using urlparam in an Elasticsearch SQL query in Kibana Canvas](https://discuss.elastic.co/t/using-urlparam-in-an-elasticsearch-sql-query-in-kibana-canvas/204816/2):
>
> Hey @Sahiru_Gunawardene, welcome to the discussion boards! Give this syntax a try. I do want to caution you though -- this is widely considered unsafe, as you are taking data from the URL (which the user controls) and injecting it into a SQL query: filters | essql query={string "SELECT project, release, sum(effort) FROM my\_index where field= '" {urlparam param=varFromURL default=1000} "' group by field1, field2" | table | render

I could not get `urlparam` working in a where clause of an SQL statement.

Can you open an issue at [Sign in to GitHub · GitHub](https://github.com/elastic/kibana/issues/new?template=Bug_report.md)?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 24, 2020, 12:35pm UTC](https://discuss.elastic.co/t/urlparams-syntax/212891/3 "2020-01-24T12:35:14Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
