Easily managing global variables externally

    A really simple script I must_include at the beginning of all my scripts to load global variables, managed in a seperate place (an Excel file in the example below, could of course be just as well SQL.

     

    Any comments of course greatly appreciated.

     

     

     

    // ---------------------------------------------------------------------------
    // Script to load global variables from Excel file and store into variables
    // ---------------------------------------------------------------------------
    
    
    // ---------------------------------------------------------------------------
    // Load global variables from Excel file into a table
    // ---------------------------------------------------------------------------
    
    
    Variables:
    LOAD Name, 
         Value 
    FROM
    [QlikView variables.xlsx]
    (ooxml, embedded labels, header is 1 lines, table is variables);
    
    
    // ---------------------------------------------------------------------------
    // Storing the global variables into variables
    // ---------------------------------------------------------------------------
    
    
    Let RowCount = NumMax(NoOfRows('Variables'),0)-1;
    For i=0 to '$(RowCount)'
      Let TempVarName = peek('Name',$(i),'Variables');
      Let TempVarValue = peek('Value',$(i),'Variables');
      Let $(TempVarName) = '$(TempVarValue)';
    Next
    
    
    // -------------------------------------------------------------------------------------------
    // A bit of housecleaning, we won't be needing the temporary variables as well as the table
    // -------------------------------------------------------------------------------------------
    
    
    Let TempVarName = null();
    Let TempVarValue = null();
    Let RowCount = null();
    DROP TABLE Variables;
    

     

    Naamloos.png