3 Replies Latest reply: Aug 20, 2014 6:21 AM by Martyn Lloyd RSS

    Qlik: Loading from Flat Files based on environment

      Hi,

       

      I have a requirement to load data from a flat file based on the environment the reload is happening in. Is there a way to achieve this? I was searching through the forum and found a few posts that talk about different connections based on environment / computer name:

       

      For the connection, the suggestion from @Ralf Becher on another post was to use something like this:

      if ComputerName() = 'COMPUTER_A' then

           CONNECT DB1....;

      elseif ComputerName() = 'COMPUTER_B' then

           CONNECT DB2....;

      else

           exit script;

      end if

       

      How could I do something similar using files? I have tried doing:

       

      LOAD Name,

        Age,

        Sex

      FROM

      if ComputerName() = 'comp123' then

      [\\......\test1\test.txt]

      (txt, codepage is 1252, embedded labels, delimiter is ',', msq);

      elseif

      ComputerName() = 'comp324' then

      [\\......\test4\test.txt]

      (txt, codepage is 1252, embedded labels, delimiter is ',', msq);

      end if

       

      but that does not seem to work. Please let me know if there are other ways of doing this.

       

      Thanks