Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

lawrance
Contributor II

Execute Command with variable

Hi all,

I try to delete the CSV files in particular folder using Execute command but it is not deleting.

The following scenarios which I tried,

S1:

EXECUTE CMD.EXE /C del "$(v_Fldr_MTR_RDG_CSV)COMED_MTR_RDG_*.csv";

EXIT Script;

S2:

EXECUTE CMD.EXE /C del "$(v_Fldr_MTR_RDG_CSV)COMED_MTR_RDG_*.csv";

EXIT Script;

S3:

EXECUTE CMD.EXE /C del "..\..\..\Shared\Shared_Common_Files\Static_Data\COMED_MTR_RDG_*.csv";

EXIT Script;

Also I have enabled the below options

option_01.png

Note: The variable contains folder path location ..\..\..\Shared\Shared_Common_Files\Static_Data\

When I run the above script in QMC it is deleting.

Thanks,

Lawrance A

1 Solution

Accepted Solutions
Highlighted
balabhaskarqlik
Honored Contributor

Re: Execute Command with variable

S1:

EXECUTE CMD.EXE /C del $(v_Fldr_MTR_RDG_CSV)"COMED_MTR_RDG_*.csv";

EXIT Script;

View solution in original post

10 Replies
Highlighted

Re: Execute Command with variable

have you tried checking this option in Setting->User preference

Highlighted
RSvebeck
Valued Contributor

Re: Execute Command with variable

Same user running the qmc service as when you are running QV Desktop? If not, your user has perhaps not the correct file/folder access?

Svebeck Consulting AB
Highlighted
lawrance
Contributor II

Re: Execute Command with variable

Hi Chawda,

Yes, It is in enabled state but not working

Thanks,

Lawrance A

Highlighted
lawrance
Contributor II

Re: Execute Command with variable

Hi Svebeck,

Here I missed one thing.

If I give full path without storing variable and without using ..\..\..\Share\

For Example,

I got output when using below mentioned script but I need to do in variable

EXECUTE CMD.EXE /C del "E:\Source\Shared\Shared_Common_Files\Static_Data\COMED_MTR_RDG_*.csv";

EXIT Script;

Thanks,

Lawrance A

Highlighted
vishsaggi
Esteemed Contributor III

Re: Execute Command with variable

Did you try this: I mean without Quotes while reading from variable. And is your E a shared drive or a local drive on the server. IF it is a shared drive you might have to use actual drive name like \\sharedfile\Source\......; some thing like this.

SET v_Fldr_MTR_RDG_CSV = 'E:\Source\Shared\Shared_Common_Files\Static_Data\';

EXECUTE CMD.EXE /C del  $(v_Fldr_MTR_RDG_CSV)COMED_MTR_RDG_*.csv;

EXIT Script;

Highlighted
lawrance
Contributor II

Re: Execute Command with variable

Hi,

I have tried but in Variable overview not in Script.

Thanks,

Lawrance A

Highlighted
balabhaskarqlik
Honored Contributor

Re: Execute Command with variable

S1:

EXECUTE CMD.EXE /C del $(v_Fldr_MTR_RDG_CSV)"COMED_MTR_RDG_*.csv";

EXIT Script;

View solution in original post

Highlighted
vishsaggi
Esteemed Contributor III

Re: Execute Command with variable

Does not matter did you give a try ? Is it still not working?

Highlighted
lawrance
Contributor II

Re: Execute Command with variable

Hi Bhaskar,

Thanks for your response.

I got the output which which I'm expected.

I have tried below scenario and got output.

Script:

EXECUTE CMD.EXE /C del $(v_Fldr_MTR_RDG_CSV)"COMED_MTR_RDG_*.csv";

EXIT Script;

Also update the variable in variable overview.

v_Fldr_MTR_RDG_CSV = E:\Source\Shared\Shared_Common_Files\Static_Data\


Now, it is working fine.


Thanks for all your reply.


Thanks,

Lawrance A