Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dynamic query in QV???

Hi Community,

        I am planning to build an application to allow users to select parameters in QV front end and these parameters need passed back to Query in QV. For example, I have a table (tbl_cohortDefinition) to store the cohort definition like cohortID=1, age>10, gender = male, cohortID=2, Age<18, gender =Female. I need pass these parameters back to QV to load data. The query in QV is like SELECT * FROM tbl_cohort WHERE age>ageParameter and Gender= GenderParameter. When user select cohortID 1, age >10 and Gender =Male will pass back to the query to get the records I need. Is this possible? What are the options? Thanks

Longmatch

9 Replies
tresesco
MVP
MVP

you have to try something like this:

LET vValue = Input('Enter your value', 'Input box');

Load

*

FROM  <your source> Where <Your Field> >= $(vValue);

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

This is a very common question coming from a new QlikView developer coming from the report writing environment.

There, we used to define the fliters for each report and then load the data that's only relevant for the specific selection.

In QlikView, we do things differently. We load all the data that's relevant for a specific analysis, into the document (typically overnight) and then allow the user to make selections on the screen. So, in your case, you'd load all the ages and all the genders and then allow users to select Gender and Age on the screen, by clicking on a List Box.

Otherwise, you are asking the users to make their selections and then wait while you load your data. That's too long, in most cases.

best,

Oleg Troyansky

Not applicable
Author

I hope I am able to use QV to display the patient information related a cohort defined in another application (web based). It is not practical to load all the medical record data into QV. It is too too big and the performance will be a big problem. What I wanted to achieve is to allow users to select a cohort from dashboard and the cohort parameters such as year, ICD9 code, Procedure code and Medications will be passed back to QV to load the data. I am hoping I state my questions clear enough. Thanks.

Not applicable
Author

Is this possible to pass the values selected in listbox back to QV? Another possible option is to build a dynamic SQL in SQL server. I am thinking of a lot options, but none of them works. Thanks

Not applicable
Author

Hi.

I think you should use partial reload (prefix "replace"). User can push the button after he selected all parametres. Button should have action to fill variables you created before. Then you can use these variables in your "where expression" in load script.

Not applicable
Author

Thanks. Do you have a sample or tutorial I can follow?

Not applicable
Author

Look this example. Select all filters and push button.In table "required data" will appear information you selected

Not applicable
Author

Hi Haijun ,

It will not happen from Qlikview ...

It is just a reporting tool with minimum extraction capabilities..

Eventhough it happens it is a labourious process to get the data..

If it happens what is point of Creationg QvDs and incremental load for QVDs..

I think u will get it now how qlikview works..

Regards,

koti

Not applicable
Author