Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How do I load only rows user needs today?

How do I load only rows user needs today?  I see how to load from a database using ODBC and SQL, but I do not see how to load only the data the user needs.   It may take an hour to load a year's worth of data.   Can a user set a start date that determines how much is loaded today?   I searched the forum but perhaps did not use the proper keywords to find this topic if it already exists.

1 Solution

Accepted Solutions
Nicole-Smith

LET vStartDate = '2012-09-14'; //This date can be made whatever you want, but the date

                                             //must be in the same format that it is in SQL

Table:

LOAD Field1, Field2;

SQL SELECT

    Field1,

    Field2

FROM

    "YourSQLTable"

WHERE

    DateField in ('$(vStartDate)');   

View solution in original post

5 Replies
Nicole-Smith

LET vStartDate = '2012-09-14'; //This date can be made whatever you want, but the date

                                             //must be in the same format that it is in SQL

Table:

LOAD Field1, Field2;

SQL SELECT

    Field1,

    Field2

FROM

    "YourSQLTable"

WHERE

    DateField in ('$(vStartDate)');   

Not applicable
Author

This answer works great for me.   I have a follow-on question.  I would like to see if there is a way I can offer the user a list of parameters and let them choose the parameters they want to use, then use their parameter list in the query.

Is there something similar to what you did above?  

Would the solution involve changing the $(v  for variable   to $(f  for field  ?  

Thanks,

Tom

Nicole-Smith

You can offer them a list of parameters in variable form (check out input boxes for this).  The query would then be the same as what I have above minus the LET statement.  However, you have to remember that when they change what is in the variable, that won't be reflected automatically on the dashboard.  A reload needs to happen in order for this to be reflected.  If you are hosting the dashboard on a server, I don't think this will work.

Not applicable
Author

Thanks,

Does this work if they are allowed to select more than one item? I thought a variable was for a single item.

Tom

Nicole-Smith

You could have two variables (StartDate and EndDate) and do a load where LoadDate >= StartDate AND LoadDate <= EndDate.

*Note that what I have above is not correct syntax.