3 Replies Latest reply: Jan 2, 2014 10:46 AM by Colin Albert RSS

    Issue with sending list parameter in Subroutine

      This is my Sub:

      sub FilesLoad(Root,FileName,RunIdList)

        let vTableName = '$(FileName)';

        let vRunList = '$(RunIdList)';

        let vConcatenate = ;   

        sub ScanFolder(Root)           

              for each FoundFile in filelist(Root&'\*.csv') 

              let vTemp= subfield('$(FoundFile)','\',-3);

        if(match(subfield('$(FoundFile)','\',-3), '$(vRunList)')) then

        if (match(upper(left(mid('$(FoundFile)', index('$(FoundFile)', '\', -1) +1), len(mid('$(FoundFile)', index('$(FoundFile)', '\', -1) +1)) -19)),'$(vTableName)')) then 



                      LOAD *  

                      FROM '$(FoundFile)' (txt, codepage is 1252, no labels, delimiter is '|', msq);   


                      Set vConcatenate = Concatenate;


               next FoundFile  

          for each SubDirectory in dirlist( Root & '\*' )   

              call ScanFolder(SubDirectory)   

          next SubDirectory

          STORE '$(vTableName)' into 'C:\test\$(vTableName).qvd' (qvd);   

        end sub

        call ScanFolder(Root)

      end Sub

      This is how I call the sub:

      set vList = 1;

        set vRoot = 'C:\decisioning\log\dcs\';

        call FilesLoad('$(vRoot)','DCS_META_DATA','$(vList)')

      When I send it like this, it works and creates a table.

      but when I send it with a list in the last param it crashes.


      set vList = 1,3;

        set vRoot = 'C:\decisioning\log\dcs\';

        call FilesLoad('$(vRoot)','DCS_META_DATA','$(vList)')

      It crashes in the Sub in the : for each FoundFile in filelist(Root&'\*.csv')


      What can be wrong?