Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
SandeepBiswas
Contributor
Contributor

How to pass input parameters from Qlik Sense to limit the data fetched from database?

We have a requirement where the user will provide a date range as input. The database contains millions of records but based on the date range chosen by the user, the query should narrow the resultset to be brought back. We have implemented date picker to select the range. Now how do we pass these dates to the SQL query from Qlik Sense? 

An example query may be,

SELECT POLICY_NUM, POLICY_HOLDER_NAME FROM POLICY WHERE ISSUE DATE BETWEEN @START_DATE and @END_DATE

Labels (2)
5 Replies
Channa
Specialist III
Specialist III

u can try with stored procedure

 

https://www.youtube.com/watch?v=o1uBAMrVyFE

 

 

Channa
SandeepBiswas
Contributor
Contributor
Author

This video is about Qlik View. We are using Qlik Sense.

rajreddys
Contributor
Contributor

Hello, did you find a solution for this, I have a similar use case of passing parameters to a where clause in oracle.

JustinDallas
Specialist III
Specialist III

When you create your SQL Statement, you append to it the parameters of your WHERE clause.  Or you can create a sproc, and then add those parameters to the SQL Statement

rajreddys
Contributor
Contributor

I am using the following query with input parameters. I see the values are replaced with the parameter values in the query. However when loading the data, there are no records loaded. If I replace the parameter values with actual values the data would be loaded. Please suggest if there is anything I am missing.

 

LIB CONNECT TO 'TEST';

Set v_gl_segment_name = 'Activity Code';
Set v_gl_segment_value = '10';
DIRECT QUERY DIMENSION
TEST.COMPANY,
TEST1.ACCOUNT,
MEASURE
SUM(TEST.AMOUNT) AS AMOUNT,
1 AS LINE_CT
FROM TEST ,
TEST1,
WHERE 1=1 AND
TEST.SEGMENT_NAME='$(v_gl_segment_name)' AND TEST1.CREDIT_CODE='$(v_gl_segment_value)'