Pocket Query: Question on Dynamic Parameters
Asked by Pranjal Shukla:

* Is it possible to have Dropdown for parameters out of the box? I did some change to the template example and made it work but it's very rough. Needs lot of structuring.

```
&lt;form method="get" class="aui pq-dynamic-parameter-form" action=""&gt;  &lt;button type="submit" class="pq-change-button aui-button aui-style aui-button-primary"&gt;Change!&lt;/button&gt;  #foreach($key in $queryParameters.keySet())  #set($reqKey = "pq_$key")  &lt;div&gt;    &lt;label for="$reqKey"&gt;$key&lt;/label&gt;    &lt;select class="text" id="$reqKey" name="$reqKey" value="$!req.getParameter($reqKey)"&gt;		&lt;option value="CRITICAL"&gt;CRITICAL&lt;/option&gt;		&lt;option value="MAJOR"&gt;MAJOR&lt;/option&gt;		&lt;option value="WARNING"&gt;WARNING&lt;/option&gt;		&lt;/select&gt;  &lt;/div&gt;  #end&lt;/form&gt;$PocketQuery.template("default")
```

* When i try to draw a chart (Using Confluence Chart Macro and Using PC Templates to draw charts) with results of a query that has dynamic parameters, i don't see an option to change the parameter. I'd like to re-draw a chart based on changed parameters.
* How do i provide value in LIKE clause using dynamic parameters?
* How do i bring in Date Picker in the parameters?


Answers:
author: Felix Grund (Scandio)
body: **P5: DatePicker**

Put this in your template:

```
&lt;div class="field-group"&gt;	&lt;label for="input-date"&gt;Choose Date:&lt;/label&gt;	&lt;input id="input-date" class="pq-datepicker" /&gt;&lt;/div&gt;
```

Then later in the script tag call this:

```
jQuery('.pq-datepicker').datePicker({overrideBrowserDefault: true});
```

**P6: LIKE**

1.) Full LIKE clause

Example Query:

```
SELECT Name, PopulationFROM CountryWHERE Name LIKE :CountryNameFullLike
```

For CountryName "Germany" you could enter this in your macro, for example: *%erma%*

2.) Only part of the LIKE clause

```
SELECT Name, PopulationFROM CountryWHERE Name LIKE CONCAT('%',:CountryNameMiddlePart,'%')
```

For CountryName "Germany" you could enter this in your macro, for example: *erma*

*===*

Let me know if this helps!


author: Pranjal Shukla
body: Felix,

In my initial question i asked for 3 points. On first one, discussion is going on. Could you please answer the remaining two i.e.

* How do i provide value in LIKE clause using dynamic parameters?
* How do i bring in Date Picker in the parameters?


author: Felix Grund (Scandio)
body: **P4:**

Actually, I think this is an issue very similar to this one: <https://answers.atlassian.com/questions/32997105>

Maybe you can first evaluate if this helps you?

comments: author: Felix Grund (Scandio)
body: I just found that it could be the JS Code in the template in my answer might not work in PQ \>= 2.0.2. I asked the author of the question if it still works.


author: Felix Grund (Scandio)
body: ...I'm actually working on a better solution currently...


author: Felix Grund (Scandio)
body: Communication on the other ticket ongoing. Please check...


author: Pranjal Shukla
body: Felix,

Since i had one field in the form, i hardcoded the field and here it is like.

```
&lt;form method="get" class="aui pq-dynamic-parameter-form" action=""&gt;  &lt;button type="submit" class="pq-change-button aui-button aui-style aui-button-primary"&gt;Change!&lt;/button&gt;  &lt;div&gt;    &lt;label for="pq_Severity"&gt;Severity&lt;/label&gt;    &lt;select id="pq_Severity" name="pq_Severity" selected="$!req.getParameter("pq_Severity")"&gt;		    &lt;option value="CRITICAL"&gt;CRITICAL&lt;/option&gt;        &lt;option value="MAJOR"&gt;MAJOR&lt;/option&gt;        &lt;option value="WARNING"&gt;WARNING&lt;/option&gt;		&lt;/select&gt;  &lt;/div&gt;&lt;/form&gt;&lt;script&gt;PocketQuery.chart('BarChart', {	title: "Alerts by Severity",	width: 600,	height: 400,	bar: {groupWidth: "95%"},	legend: { position: "none" },});&lt;/script&gt;
```

* The form works as expected when **"Load Macro Dynamically"** is **Unchecked** but the parameters does not get appended to the URL when is **"Load Macro Dynamically"** is **checked**.

My requirement is, based on the value of Severity Chosen, the char should get refreshed without page reload.

Any help on Dynamic Parameters with different form type elements would help. May be another article from your side on this would be beneficial from your side.


author: Pranjal Shukla
body: Felix,

Any views on above queries??