Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

looping files using Variables and QVS

Hi All,

i am curretnly facing an issue whicle looping through multiple excel file using variable for Path, and the variables are defined in a QVS file.

When i use Code 1 and Code in QVS file - its skipping the loop and shows "Execution failed". The connection through QVS connects fine, but its not getting into the loop.

CODE 1

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

$(Include=..\..\..\Include\EMEA\EMEA_Q2C_MDF\Connection.qvs);

FOR each File in filelist ('$(vPathActivity)')                       

CrossTable(FundName, FundData, 97)

Activity:

  LOAD *

       FROM [$(File)] (ooxml, embedded labels);

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Code in QVS file

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

set errorMode=0;

OLEDB CONNECT32 TO [Provider=ADsDSOObject;Encrypt Password=False;Data Source=\\16.16.224.41\\Q2C_MDF;Mode=Read;Bind Flags=0;ADSI Flag=-2147483648];

let vPathFinance = '\\16.16.224.41\QV_InputFiles\Q2C_MDF\Finance\Finance.xlsx';

let vPathActivity = '\\16.16.224.41\QV_InputFiles\Q2C_MDF\Activity\*.xlsx';

if ScriptErrorCount >0 then

let ScriptErrorCount =0;

OLEDB CONNECT32 TO [Provider=ADsDSOObject;Encrypt Password=False;Data Source=\\16.17.84.41\\Q2C_MDF;Mode=Read;Bind Flags=0;ADSI Flag=-2147483648];

let vPathFinance = '\\16.17.84.41\QV_InputFiles\Q2C_MDF\Finance\Finance.xlsx';

let vPathActivity = '\\16.17.84.41\QV_InputFiles\Q2C_MDF\Activity\*.xlsx';

end if

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

If i use this code using direct path it works fine

CODE 2

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

FOR each File in filelist ('\\16.16.224.41\QV_Input_Files\Q2C_MDF\Activity\*.xlsx')

CrossTable(FundName, FundData, 97)

Activity:

  LOAD *

       FROM [$(File)] (ooxml, embedded labels);

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Any help is very much appriciated.!!

Regards,

Subhashish

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You're using two different paths:

\\16.16.224.41\QV_InputFiles\Q2C_MDF\Activity\*.xlsx

\\16.16.224.41\QV_Input_Files\Q2C_MDF\Activity\*.xlsx


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Gysbert,

thanks for identifying the difference in folder name. I have rectified it in the QVS, but I am still facing the same issue. "Execution failed". i guess its not getting inside the loop itself.

Many thanks for your reply and time. really appriciate!!