4 Replies Latest reply: Sep 7, 2016 9:48 AM by Stephen Naude RSS

    File Exists

    Stephen Naude

      Hello All,

       

      I have tried to create a loop to load files, it works except for the part where its supposed to identify if the file exists and just carry on if it doesn't...can anyone help please.

       

       

       

      let vSYear=2016;

      let vSMonth=6;

      let vSPe=$(vSYear)&

        if($(vSMonth)<10,'-0','-')

        &$(vSMonth);

       

       

      let vEYear=year(now());

      let vEMonth=num(month(now()),'0');

      let vEPe=$(vEYear)&

        if($(vEMonth)<10,'-0','-')

        &$(vEMonth);

       

       

      set a='$(vSPe)';

      Do While a<'$(vEPe)'

       

       

        Let vDs=1;

        Do While vDs<=31

       

        let vDss=if($(vDs)<10,'-0','-')

        &$(vDs);

       

       

        SET vFileName1='[G:\Qlikview\QVData\Zazoo\QVD\Transactions\TranUpdate2\Airtime_Transactions_$(vSPe)$(vDss).qvd]';

        LET $(vFileExsist1)=isnull(QvdCreateTime('$(vFileName1)'));

        //Let vFileExsist=if(FileSize($(vFileName))>0,-1,0);

        SET vFileName2='[G:\Qlikview\QVData\Zazoo\QVD\Transactions\TranUpdate2\PowerTransactions_$(vSPe)$(vDss).qvd]';

        Let $(vFileExsist2)=isnull(QvdCreateTime('$(vFileName2)'));

        //Let vFileExsist=if(FileSize($(vFileName))>0,-1,0);

       

       

        if $(vFileExsist1)=0 then

        t_tmp:

        LOAD DateTime as StartDate,

            ClientIdNo,

            [Age Group],

            Amount,

            TxId,

            Product

        FROM

        [G:\Qlikview\QVData\Zazoo\QVD\Transactions\TranUpdate2\Airtime_Transactions_$(vSPe)$(vDss).qvd]

        (qvd);

        End if

       

        if $(vFileExsist2)=0 then

        Concatenate (t_tmp)

        LOAD DateTime as StartDate,

            ClientIdNo,

            [Age Group],

            Amount,

            TxId,

            Product

        FROM

        [G:\Qlikview\QVData\Zazoo\QVD\Transactions\TranUpdate2\PowerTransactions_$(vSPe)$(vDss).qvd]

        (qvd);

        End if

       

       

        let vDs=$(vDs)+1;

        loop