Include files
We have already said that you should use MUST_INCLUDE
rather than INCLUDE
, but we're always surprised that many developers never use include files at all. If the same code needs to be used in more than one place, it really should be in an include file.
Suppose that you have several documents that use C:\QlikFiles\Finance\Budgets.xlsx
and that the folder name is hardcoded in all of them. As soon as the file is moved to another location, you have several modifications to make, and it's easy to miss changing a document because you may not even realize it uses the file.
The solution is simple, very effective, and guaranteed to save you many reload failures.
Instead of coding the full folder name, create something similar to this:
LET vBudgetFolder='C:\QlikFiles\Finance\';
Put the line into an include file—for instance, FolderNames.inc
.
Then, code this into each script:
$(MUST_INCLUDE=FolderNames.inc)
Finally, when you want to refer to your Budgets.xlsx
spreadsheet...