Created
January 23, 2023 15:53
-
-
Save aeveltstra/01c7ce2f159d7b9e03b58e5e51d9331b to your computer and use it in GitHub Desktop.
QlikView read user config for data analysis filters on the fly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Tell QlikView in what folder to look. | |
// The following assumes Windows-style directory separators, | |
// because QlikView runs on Windows, exclusively. | |
DIRECTORY \\server\Users\some_user\QlikView\settings; | |
// Load a spreadsheet named user_config.xls. | |
// It can be named anything, as long as you can recognize it. | |
// We gave the spreadsheet 3 columns: Setting, Value, and | |
// Explanation. Those live on a worksheet table named Settings. | |
user_config: | |
LOAD Setting as setting_name, | |
Value as setting_value, | |
Explanation as setting_xp | |
FROM user_config.xls (biff, embedded labels, table is Settings$); | |
// Read the user settings into memory variables. | |
// The variables will receive the name set in the spreadsheet. | |
Let v_amount_of_settings = NoOfRows('user_config'); | |
For v_i = 0 to (v_amount_of_settings - 1) | |
Let v_setting_name = Peek('setting_name', v_i, 'setting_value'); | |
Let [$(v_setting_name)] = Peek('setting_value', v_i, 'setting_value'); | |
Next | |
// Apply the user settings. For instance, if the setting is named | |
// Products.Filtering.ReplenishmentDate.LowerBound, then we can filter | |
// products while reading them from elsewhere, like so | |
// (note the prefix $ when reading from the variable): | |
products_filtered: | |
Noconcatenate Load * from [producs.qvd] (qvd) where | |
replenishment_date >= '$Products.Filtering.ReplenishmentDate.LowerBound' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment