Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How can I modify the script below to loop through each QVD file location? The script looks at a file location for a QVD, grabs the name of the table and counts the records in that table. I would like to do it multiple times through multiple locations.
let numRows = QvdNoOfRecords('\\filename.qvd');
let table = QvdTableName ('\\filename.qvd');
recordCount:
load * inline [
QvdTableName,numRows
$(table),$(numRows)
];
You can loop through For Next loop in the script:
Find below sample snippet
SUB DoDir (Root)
FOR Each File in filelist (Root&' \*.qvd')
let numRows = QvdNoOfRecords('$(File)');
let table = QvdTableName ('$(File)');
recordCount:
load * inline [
QvdTableName,numRows
$(table),$(numRows)
];
NEXT File
FOR Each Dir in dirlist (Root&' \*' )
call DoDir (Dir)
NEXT Dir
ENDSUB
CALL DoDir ('C:')
Do I put this in my load script?
Hi,
What if I need to look into different instances as well like dev, QA, UAT and Prod.
Yes.
There are two parts in this piece of code. A SUB...END SUB definition which defines but doesn't execute a callable procedure, and the CALL of that same SUB (last line) which executes the procedure with a starting directory as parameter.
Always put the definition before the first CALL or you will get a script error. You can put the definition on the first script tab (together with any other SUB definition), and CALL it anywhere else on the following tabs.
Peter
Just out of curiosity, is your original code snippet part of a learning exercise?
I think your answer has just arrived (3 posters asking for the same solution)