//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 1. QVServer - Restart
////////////////////////////////////////////////////// QVServer - Restart //////////////////////////////////////////////////////////
'Stopping the windows-services:
@echo off
REM -------------------------------------------------------
REM - File: QlikViewServer11_Stop.bat
REM - Description: Stop all QlikView related services (v11)
REM -------------------------------------------------------
echo Stop QlikView Services
echo ======================================================
net stop "QlikView Server"
net stop "Qlikview Directory Service Connector"
net stop "QlikView Distribution Service"
net stop "QlikView Management Service"
net stop "QlikView WebServer"
echo ======================================================
'Starting the windows-services:
@echo off
REM -------------------------------------------------------
REM - File: QlikViewServer11_Start.bat
REM - Description: Start all QlikView related services (v11)
REM -------------------------------------------------------
echo Start QlikView Services
echo ======================================================
net start "Qlikview Directory Service Connector"
net start "QlikView Distribution Service"
net start "QlikView Management Service"
net start "QlikView Server"
net start "QlikView WebServer"
echo ======================================================
taskkill /F /IM qv.exe
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 2. Post Reload - export Data into XLS
//////////////////////////////////////////////////LOOPING YEAR MONTH /////////////////////////////////////////////////////
Sub ExportQVD()
ActiveDocument.Fields("YearMonth").Clear
set val=ActiveDocument.Fields("YearMonth").GetPossibleValues(1000)
for i=0 to val.Count-1
ActiveDocument.Fields("YearMonth").Select val.Item(i).Text
'msgbox(val.Item(i).Text)
set obj = ActiveDocument.GetSheetObject("CH02")
filePath = "D:\Database\leave\leave_" & val.Item(i).Text & ".xls"
obj.Export filePath,";"
Set obj = Nothing
next
End Sub
// 1. QVServer - Restart
////////////////////////////////////////////////////// QVServer - Restart //////////////////////////////////////////////////////////
'Stopping the windows-services:
@echo off
REM -------------------------------------------------------
REM - File: QlikViewServer11_Stop.bat
REM - Description: Stop all QlikView related services (v11)
REM -------------------------------------------------------
echo Stop QlikView Services
echo ======================================================
net stop "QlikView Server"
net stop "Qlikview Directory Service Connector"
net stop "QlikView Distribution Service"
net stop "QlikView Management Service"
net stop "QlikView WebServer"
echo ======================================================
'Starting the windows-services:
@echo off
REM -------------------------------------------------------
REM - File: QlikViewServer11_Start.bat
REM - Description: Start all QlikView related services (v11)
REM -------------------------------------------------------
echo Start QlikView Services
echo ======================================================
net start "Qlikview Directory Service Connector"
net start "QlikView Distribution Service"
net start "QlikView Management Service"
net start "QlikView Server"
net start "QlikView WebServer"
echo ======================================================
taskkill /F /IM qv.exe
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 2. Post Reload - export Data into XLS
//////////////////////////////////////////////////LOOPING YEAR MONTH /////////////////////////////////////////////////////
Sub ExportQVD()
ActiveDocument.Fields("YearMonth").Clear
set val=ActiveDocument.Fields("YearMonth").GetPossibleValues(1000)
for i=0 to val.Count-1
ActiveDocument.Fields("YearMonth").Select val.Item(i).Text
'msgbox(val.Item(i).Text)
set obj = ActiveDocument.GetSheetObject("CH02")
filePath = "D:\Database\leave\leave_" & val.Item(i).Text & ".xls"
obj.Export filePath,";"
Set obj = Nothing
next
End Sub
//////////////////////////////////////////////LOOPING BY YEAR BY MONTH ///////////////////////////////////////////////
Sub ExportQVD_01()
ActiveDocument.Fields("FinancialYear").Clear
set val=ActiveDocument.Fields("FinancialYear").GetPossibleValues(1000)
for i=0 to val.Count-1
ActiveDocument.Fields("FinancialYear").Select val.Item(i).Text
set valj=ActiveDocument.Fields("Month").GetPossibleValues(1000)
for j=0 to valj.Count-1
ActiveDocument.Fields("Month").Select valj.Item(j).Text
set valk=ActiveDocument.Fields("MonthName").GetPossibleValues(1000)
'msgbox(val.Item(i).Text)
set obj = ActiveDocument.GetSheetObject("CHRP01")
filePath = "D:\QlikView App - Phase2\Data\QVD\FIN_EXPORT\FIN_EXPORT_01_" &valk.Item(0).Text & ".xls"
obj.Export filePath,";"
Set obj = Nothing
set obj = ActiveDocument.GetSheetObject("CHRP02")
filePath = "D:\QlikView App - Phase2\Data\QVD\FIN_EXPORT\FIN_EXPORT_02_" &valk.Item(0).Text & ".txt"
obj.Export filePath,";"
Set obj = Nothing
next
ActiveDocument.Fields("Month").Clear
ActiveDocument.Fields("MonthName").Clear
next
ActiveDocument.Fields("FinancialYear").Clear
ActiveDocument.Save
End Sub
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 3. LOOPING Reduce Macro
// 3. LOOPING Reduce Macro
//////////////////////////////////////////////LOOPING Reduce Macro///////////////////////////////////////////////////////////////
1. Batch ( To trigger Reload / Distribute )
"c:\Program Files\QlikView\Qv.exe" /vA_IP=200 "D:\Qlikview App\AccessPoint_Display\FIS_Dashboard_Display_v3.qvw"
"c:\Program Files\QlikView\Qv.exe" /vA_IP=201 "D:\Qlikview App\AccessPoint_Display\FIS_Dashboard_Display_v3.qvw"
2. Edit Script
On Open Macro : Call vReduce
3. Macro
Sub vReduce
SIP=getQVVariableAsString("A_IP")
if(SIP>"1") THEN
ActiveDocument.DoReload 0
ActiveDocument.ClearAll
set fldIP= ActiveDocument.getField("IP")
fldIP.Select SIP
ActiveDocument.ReduceData
ActiveDocument.GetVariable("A_IP").SetContent "0", false
ActiveDocument.SaveAs "D:\Qlikview App\AccessPoint_Display\3 Thales_FIS_Dashboard_Display_"&SIP&".qvw"
ActiveDocument.GetApplication.Quit 0
End If
End Sub
Function getQVVariableAsString(aQVVarName)
set v = ActiveDocument.Variables(aQVVarName)
getQVVariableAsString = v.GetContent.String
End Function
4. Batch Open ( Distributed files )
taskkill /F /IM qv.exe
taskkill /F /IM IEXPLORE.exe
start /max qv "\\10.77.1.55\QlikView App\Access Point_WIP\3 Dashboard - Display_WIP_40.qvw"
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 4. Cleaning Windows Temp Files
// 4. Cleaning Windows Temp Files
/////////////////////////////////////////////Cleaning Windows Temp Files////////////////////////////////////////////////////////
@echo on
cd %homedrive%%homepath%
del /s/f/q locals~1\tempor~1
del /s/f/q locals~1\temp\tempor~1
del /s/f/q cookies
del /s/f/q temp\cookies
del /s/f/q locals~1\historique
del /s/f/q locals~1\temp\historique
del /s/f/q c:\windows\prefetch
del /s/f/q recent
del /s/f/q %temp%
md recent
del /s/f/q locals~1\temp
del /s/f/q C:\Users\ACHIEVER\AppData\Roaming\Microsoft\Windows\Recent\%
del /s/f/q C:\Users\ACHIEVER\AppData\Roaming\Microsoft\Office\Recent\%
md locals~1\temp