Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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)');
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)');
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
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.
Thanks,
Does this work if they are allowed to select more than one item? I thought a variable was for a single item.
Tom
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.