Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys,
I am new to QV, could you tell script to fetch the CD drive space of a local machine?
Deepti
First open a command prompt and then execute the command dir c: d: > dirlist.txt. Then open Qlikview and add this to your script:
Data:
LOAD * WHERE len(Drive);
LOAD
if(SubStringCount(previous(line),'Volume in drive'),mid(previous(line),17,1)) as Drive,
If(SubStringCount(line,'bytes free'),trim(TextBetween(line, 's) ',' bytes free'))) as BytesFree;
LOAD [@1:n] as line
FROM [dirlist.txt] (fix, codepage is 1252, no labels)
WHERE SubStringCount([@1:n],'Volume in drive') or SubStringCount([@1:n],'bytes free')
If you want to be able to execute the command line command from inside Qlikview then you first need to disable some security settings so you can do dangerous things like starting arbitrary programs from Qlikview. One of these setting can be found on the Settings tab of the Script Editor: Can Execute External Programs.
Can you explain what you mean with "fetch the CD drive space"?
for C drive
Execute cmd.exe /C "dir c: > space.txt";
SPACE:
LOAD @1
FROM
space.txt
(txt, codepage is 1252, explicit labels, delimiter is '\t', msq)
Where @1 like '*byte*';
Well, I want to Fetch the available space of the C and D drive of a local machine and store it in QVD.
When I tried to execute the "dir c: > space.txt"; in command prompt. I got message saying access denied.
Please explain in detail.
First open a command prompt and then execute the command dir c: d: > dirlist.txt. Then open Qlikview and add this to your script:
Data:
LOAD * WHERE len(Drive);
LOAD
if(SubStringCount(previous(line),'Volume in drive'),mid(previous(line),17,1)) as Drive,
If(SubStringCount(line,'bytes free'),trim(TextBetween(line, 's) ',' bytes free'))) as BytesFree;
LOAD [@1:n] as line
FROM [dirlist.txt] (fix, codepage is 1252, no labels)
WHERE SubStringCount([@1:n],'Volume in drive') or SubStringCount([@1:n],'bytes free')
If you want to be able to execute the command line command from inside Qlikview then you first need to disable some security settings so you can do dangerous things like starting arbitrary programs from Qlikview. One of these setting can be found on the Settings tab of the Script Editor: Can Execute External Programs.