-
Notifications
You must be signed in to change notification settings - Fork 29
/
InitLink.qvs
117 lines (104 loc) · 5.73 KB
/
InitLink.qvs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
;
/* ___________________________________________________________________________
| Qlik Deployment Framework InitLink.qvs
| InitLink.qvs is the container identifier
| InitLink is used as "sling shot" to 1.Init.qvs for QlikView and Qlik Sense
|___________________________________________________________________________*/
trace '### QDF Info, InitLink trying to link to initiation script'; //Writing information in log
// Run Container initiation
// Modify setting if the default .Include folder is changed, usually leve as is
LET vL.QDF.IncludeFolder='Include';
// Modify setting if the default .BaseVariable folder is changed, usually leve as is
SET vL.QDF.BaseVariableFolder='BaseVariable';
LET vL.QDF.RootPath_tmp='$(vG.RootPath)'; // vL.QDF.RootPath_tmp is used to identify global variable cache
LET vL.QDF.BasePath_tmp='$(vG.BasePath)'; // vL.QDF.BasePath_tmp is used to identify global variable cache
// Cleanup, Removing old values
SET vG.BasePath=;
SET vL.QDF.BaseVariablePath=;
SET vG.RootPath=;
//***************** Initiation for Qlik Sense and QlikView **********************************
// Qlik Sense additions Validating if LIB root exists if yes then add this as vG.RootPath
// Validate Separate LIB mounts
if not '$(vG.HomeContainer)' = '' and not IsNull(filesize('lib://$(vG.HomeContainer)/Initlink.qvs')) = -1 then
LET vG.BasePath= 'lib://$(vG.HomeContainer)/';
trace '### DF Info, identified Sense home container $(vG.BasePath) (Separate LIB mounts)';
elseif not '$(vG.HomeContainer)' = '' and not IsNull(filesize('$(vG.HomeContainer)/Initlink.qvs')) = -1 then
LET vG.BasePath= '$(vG.HomeContainer)/';
trace '### DF Info, identified Sense home container $(vG.BasePath) (Separate LIB mounts)';
elseif '$(vG.HomeContainer)' = '' and not IsNull(filesize('lib://Shared/*')) = -1 then
LET vG.BasePath= 'lib://Shared/';
trace '### DF Info, identified Sense Shared home container (Separate LIB mounts)';
elseif '$(vG.HomeContainer)' = '' and not IsNull(filesize('lib://shared/*')) = -1 then
LET vG.BasePath= 'lib://shared/';
trace '### DF Info, identified Sense shared home container (Separate LIB mounts)';
else // Validate single LIB mount
if not '$(vG.RootContainer)' = '' and not IsNull(filesize('lib://$(vG.RootContainer)/*')) = -1 then
LET vG.RootPath= 'lib://$(vG.RootContainer)/';
trace '### DF Info, identified Sense root path $(vG.RootPath) (single LIB mount)';
SET vG.RootContainer = ;
elseif not '$(vG.RootContainer)' = '' then
trace '### DF Warning, could not find root container with name $(vG.RootContainer)';
SET vG.RootContainer = ;
elseif not IsNull(filesize('lib://Root/*')) = -1 then
LET vG.RootPath= 'lib://Root/';
trace '### DF Info, identified Sense root path $(vG.RootPath) (single LIB mount)';
elseif not IsNull(filesize('lib://root/*')) = -1 then
LET vG.RootPath= 'lib://root/';
trace '### DF Info, identified Sense root path $(vG.RootPath) (single LIB mount)';
endif
// Validate fixed root url
if not '$(vG.HomeContainer)'='' and not IsNull(filesize('$(vG.RootPath)$(vG.HomeContainer)\Initlink.qvs')) = -1 then
LET vG.BasePath= '$(vG.RootPath)$(vG.HomeContainer)\';
trace '### DF Info, identified Sense home container $(vG.BasePath)';
elseif not '$(vG.RootPath)' = '' and not IsNull(filesize('$(vG.RootPath)99.Shared_Folders/*')) = -1 then
LET vG.BasePath= '$(vG.RootPath)99.Shared_Folders/';
trace '### DF Info, identified Sense home container $(vG.BasePath)';
elseif not '$(vG.RootPath)' = '' then // Search for Initlink.qvs in a valid container under Root
for each vL.QDF.DoDir in dirlist ('$(vG.RootPath)*')
if filesize('$(vL.QDF.DoDir)\Initlink.qvs') > 1 then
LET vG.BasePath= '$(vL.QDF.DoDir)\';
trace '### DF Info, identified Sense home container $(vG.BasePath)';
endif
exit for when not '$(vG.BasePath)'='';
next vL.QDF.DoDir
set vL.QDF.DoDir=;
else // This is the QlikView vG.BasePath initiation section
LET vG.BasePath=;
for vL.x_loop =1 to 20-1
LET vL.QDF.InitLinkPath_tmp='$(vL.QDF.InitLinkPath)';
if FileTime('$(vL.QDF.InitLinkPath)InitLink.qvs') > 0 then
// Set vG.BasePath based on InitLink.qvs location
LET vG.BasePath=left(DocumentPath(),index(DocumentPath(),'\', -(substringcount( '$(vL.QDF.InitLinkPath)','\' )+1)));
endif
LET vL.QDF.InitLinkPath='..\'&'$(vL.QDF.InitLinkPath_tmp)';
exit for when not '$(vG.BasePath)'= ''
next
SET vL.QDF.InitLinkPath = ;
SET vL.QDF.InitLinkPath_tmp = ;
SET vL.x_loop = ;
endif
endif
if '$(vG.BasePath)'= '' then // validate initiation
trace '### QDF Warning, could not identify any valid container path, will exit';
trace '### QDF Warning, if using Qlik Sense add SET vG.HomeContainer=container name before InitLink.qvs';
LET vG.BasePath=;
exit script;
endif
SET vG.HomeContainer = ;
SET vG.RootContainer = ;
//***************** Initiation for Qlik Sense and QlikView done **********************************
//Identify BaseVariablePath location during initiation
for each vL.QDF.DoDir in dirlist ('$(vG.BasePath)*') //Search for a valid container under Root
if right('$(vL.QDF.DoDir)',len('$(vL.QDF.IncludeFolder)'))='$(vL.QDF.IncludeFolder)' then
for each vL.QDF.DoDir2 in dirlist ('$(vL.QDF.DoDir)\*') //Search for a valid container under Root
if right('$(vL.QDF.DoDir2)',len('$(vL.QDF.BaseVariableFolder)'))='$(vL.QDF.BaseVariableFolder)' then
LET vL.QDF.BaseVariablePath= '$(vL.QDF.DoDir2)\';
endif
exit for when right('$(vL.QDF.DoDir2)',len('$(vL.QDF.BaseVariableFolder)'))='$(vL.QDF.BaseVariableFolder)';
next vL.QDF.DoDir2
endif
exit for when right('$(vL.QDF.DoDir)',len('$(vL.QDF.IncludeFolder)'))='$(vL.QDF.IncludeFolder)';
next vL.QDF.DoDir
SET vL.QDF.DoDir=;
SET vL.QDF.DoDir2=;
$(Include=$(vL.QDF.BaseVariablePath)1.Init.qvs);