-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathInitLink.qvs
executable file
·98 lines (86 loc) · 5.77 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
;
/* ___________________________________________________________________________
| Qlik Deployment Framework InitLink.qvs 1.Init.qvs
| InitLink.qvs and 1.Init.qvs are container identifier (identical code 1.Init is legacy)
|___________________________________________________________________________*/
trace '### QDF Info, Initiation Started'; // Writing information
// set vL.QDF.LoadCustom to variable csv file name, default 'Custom.Variables.csv'
// Remark or blank vL.QDF.LoadCustom to skip loading Variables during initiation
set vL.QDF.LoadCustom='Custom.Variables.csv';
//Set global variables for include scripts
//Determin if it's shared scripts used, by setting vG.SharedInclude or vG.Include in script initiaiton
Switch lower(right('$(vG.HomeContainer)',6)) // identifing shared container
case 'shared'
SET vL.QDF.SharedInclude='Shared'; //Shared does not contain slash
//Set global variables for BasePath related to the space the app is executing from
SET vG.BasePath= 'lib://:'; // same as current space lib: // [space]: Datafiles / *. qvd
SET vG.QVDPath= '$(vG.BasePath)DataFiles/';
LET vG.$(vL.QDF.SharedInclude)BasePath='$(vG.HomeContainer)'; // Set Home BasePath
case 'hared/' //Shared contains front-slash
SET vL.QDF.SharedInclude='Shared';
//Set global variables for BasePath related to the space the app is executing from
SET vG.BasePath= 'lib://:'; // same as current space lib: // [space]: Datafiles / *. qvd
SET vG.QVDPath= '$(vG.BasePath)DataFiles/';
LET vG.$(vL.QDF.SharedInclude)BasePath=left('$(vG.HomeContainer)',len('$(vG.HomeContainer)')-1); // Set Home BasePath remove slash due to SaaS limitations
case 'hared\' //Shared contains back-slash
SET vL.QDF.SharedInclude='Shared';
//Set global variables for BasePath related to the space the app is executing from
SET vG.BasePath= 'lib://:'; // same as current space lib: // [space]: Datafiles / *. qvd
SET vG.QVDPath= '$(vG.BasePath)DataFiles/';
LET vG.$(vL.QDF.SharedInclude)BasePath=left('$(vG.HomeContainer)',len('$(vG.HomeContainer)')-1); // Set Home BasePath remove slash due to SaaS limitations
case '' //vG.HomeContainer container not found
SET vL.QDF.SharedInclude=''; // Remove shared folder
trace '### QDF warning, QDF could not resolve vG.HomeContainer'; //Writing information
trace '### QDF warning, preceding initiation, please add variable vG.HomeContainer with path to external QDF container'; //Writing information
default
SET vL.QDF.SharedInclude=''; // No shared folder, use alternative container as base path
LET vG.BasePath='$(vG.HomeContainer)'; // Set Home BasePath
end switch
if not IsNull(filesize('$(vG.$(vL.QDF.SharedInclude)BasePath)/InitLink.qvs')) = -1 then // Validate container in cloud storage
for each vL.QDF.DoDir in dirlist ('$(vG.$(vL.QDF.SharedInclude)BasePath)')
if not IsNull(filesize('$(vL.QDF.DoDir)/Info.txt')) = -1 then
if len(subfield('$(vL.QDF.DoDir)','.',-1)) < 12 then //### QDF identifies what delimiter to use for variable name (16 is max length of any QDF folder)
let vL.QDF.Foldername =subfield('$(vL.QDF.DoDir)','.',-1);
else
let vL.QDF.Foldername =subfield('$(vL.QDF.DoDir)','/',-1);
endif
LET vG.$(vL.QDF.SharedInclude)$(vL.QDF.Foldername)Path='$(vL.QDF.DoDir)'; //Generating global variable
trace '### Global Variable: vG.$(vL.QDF.SharedInclude)$(vL.QDF.Foldername)Path';
for each vL.QDF.SubDir in dirlist ('$(vL.QDF.DoDir)')
if not IsNull(filesize('$(vL.QDF.SubDir)/Info.txt')) = -1 then
if len(subfield('$(vL.QDF.SubDir)','.',-1)) < 16 then //### QDF identifies what delimiter to use for variable name (16 is max length of any QDF folder)
let vL.QDF.Foldername =subfield('$(vL.QDF.SubDir)','.',-1);
else
let vL.QDF.Foldername =subfield('$(vL.QDF.SubDir)','/',-1);
endif
LET vG.$(vL.QDF.SharedInclude)$(vL.QDF.Foldername)Path='$(vL.QDF.SubDir)'; //Generating global variable
trace '### Global Variable: vG.$(vL.QDF.SharedInclude)$(vL.QDF.Foldername)Path';
endif
next vL.QDF.SubDir
endif
next vL.QDF.DoDir
else
trace '### QDF warning, QDF could not identify any external QDF container'; //Writing information in log
trace '### QDF warning, Please validate that $(vG.HomeContainer) points to an external QDF container'; //Could not find container
endif
if not IsNull(filesize('vG.$(vL.QDF.SharedInclude)SubPath)/99.LoadAll.qvs')) = -1 then
trace '### QDF warning, QDF could not identify function-library'; //Writing information in log
trace '### QDF warning, Please identify that Info.txt file exists in all QDF related folders'; //Could not find vG.SubPath
endif
// 99.LoadAll.qvs pre-loads QDF function-library within identified container
$(Include=$(vG.$(vL.QDF.SharedInclude)SubPath)/99.LoadAll.qvs);
// Shared_Folders Initiation
// Load Include for LCGV function
// This function is to be used in QDF scripts to link between containers
if '$(vL.QDF.SharedInclude)'= '' then
CALL LCGV('Shared'); //Load shared folders if the cloud setup has not loaded this already
endif
// Loading Custom Variables (CustomVariable file) from shared or home Container
call LoadVariableCSV('$(vG.$(vL.QDF.SharedInclude)BaseVariablePath)/$(vL.QDF.LoadCustom)');
// Initiation of 4.Custom within home or shared container
$(Include=$(vG.$(vL.QDF.SharedInclude)BaseVariablePath)/4.Custom.qvs); // Loading 4.Custom from current container
SET vL.QDF.Foldername =;
SET vL.QDF.DoDir=;
SET vL.QDF.SubDir=;
SET vL.QDF.SharedInclude=;
SET vL.QDF.LoadCustom=;