Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Had an ask to create a dashboard that would show the start and end times for all dashboards and call out errors.
Our dashboards are in multiple nested file paths so this loops through multiple directories and/or servers to produce 1 report.
Sorry I had to scramble paths, server names and dashboard names.
You only need to change the call scan folder to match your paths.
//
Set vConcatenate = ;
sub ScanFolder(Root)
for each FileExtension in 'log'
for each FoundFile in filelist( Root & '\*.' & FileExtension)
MAIN:
$(vConcatenate)
LOAD *, '$(FoundFile)' as SourceFile, if(Index(@1,'Execution Failed')>0,'FAILED') as JobStatus,
trim(right(@1,len(@1)-index(@1,':',-1)-1)) as errorLine,
left(subfield('$(FoundFile)','\',-1),len((subfield('$(FoundFile)','\',-1)))-4) as Dashboard,
left(@1,index(@1,':',-1)-1) as ActionTime
FROM [$(FoundFile)] (txt, unicode, no labels, delimiter is '\n', msq);
Set vConcatenate = Concatenate;
next FoundFile
next FileExtension
for each SubDirectory in dirlist( Root & '\*' )
call ScanFolder(SubDirectory)
next SubDirectory
end sub
Call ScanFolder('\\xxxxx\QlikviewFiles\SourceDocuments\MAIN\09_App') ;
//Substitute your full paths can handle as many folder paths as you like.
Call ScanFolder('\\xxxx2\QlikviewFiles\SourceDocuments2\Other Dashboards') ;
MAIN2:
NoConcatenate
load *,
left(SourceFile,len(SourceFile)- (len(Dashboard)+4)) as Path resident MAIN
where wildmatch(errorLine,'*Execution finished*','*Execution started*','*Execution failed*')>0;
Load * inline [errorLine,Line Status
Execution started., 1-STARTED
Execution finished.,2-FINISHED
Execution Failed, 3-FAILED];
drop table MAIN;
load Dashboard, 1 as FailureFlag
resident MAIN2
where JobStatus='FAILED';
//