Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to update query based upon user's selection in inputbox?

Hi experts,

          I used this post to to update the query based upon user's selection (or entry) in Inputbox, This is what I did.

1. Create a variable vSelectedValue in Settings-Variable overview with a value 2013.

2. In Inputbox property - chose vSelectedValue as ONLY displayed variables.

3. In SQL I used WHERE year(a.DischargeDTS)='$(vSelectedValue)'

However, when I selected (or enter) different values (2011,2012). The data is not updated. I do not what I have missed.

Thanks

Longmatch

6 Replies
whiteline
Master II
Master II

Hi.

If you manually substitute into the WHERE statement the values that you've entered, I think you'll see the problem with syntax.

Not applicable
Author

Hi Whiteline,

I cannot find what is wrong with my code. Please see my example in the attachment. Thanks

Longmatch

maxgro
MVP
MVP

Hi

in my environment with a SqlServer db it works when I reload

I only changed

='$(vSelectedValue)'

with

=$(vSelectedValue)

SQL

SELECT TOP 10

[dat_data]

FROM [sisim_stat].[dbo].[d003_date]

where year(dat_data) >= $(vSelectedValue)

;

Regards

Not applicable
Author

Hi Massimo,

I made changes based upon your suggestions, but nothing happened when I either selected a value from Inputbox or entered a value into Inputbox. It looks like the value is linked back to SQL query. Inputbox links to variable (vSelectedValue) which was defined in Variable window and was used in SQL. I would like to know how to pass the selected value in Inputbox back to query? Is trigger required? Thanks

Longmatch

Not applicable
Author

You might find this interesting.  (Dynamic Update)

How to use Dynamic update action in QV 11

Thanks,

Angad

whiteline
Master II
Master II

The script is executed only during document reload.

No matter what you've entered in the inputbox or variable, to get changes you need reload the document with a user action or trigger/button.

There are also some special possibilities as Dynamic update and so on, but this could not be the case to use them.

Why do you want to use SQL query? You can use common approach, load all years and then let the user use the associative logic of QlikView.