-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloadScript.qvs
More file actions
212 lines (185 loc) · 5.97 KB
/
Copy pathloadScript.qvs
File metadata and controls
212 lines (185 loc) · 5.97 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
///$tab Environment Variables
SET ThousandSep=',';
SET DecimalSep='.';
SET MoneyThousandSep=',';
SET MoneyDecimalSep='.';
SET MoneyFormat='#,##0.00; (#,##0.00)';
SET TimeFormat='h:mm:ss TT';
SET DateFormat='DD/MM/YYYY';
SET TimestampFormat='DD/MM/YYYY h:mm:ss[.fff] TT';
SET FirstWeekDay=6;
SET BrokenWeeks=1;
SET ReferenceDay=0;
SET FirstMonthOfYear=1;
SET CollationLocale='en-US';
SET CreateSearchIndexOnReload=1;
SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';
SET LongMonthNames='January;February;March;April;May;June;July;August;September;October;November;December';
SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';
SET LongDayNames='Monday;Tuesday;Wednesday;Thursday;Friday;Saturday;Sunday';
SET NumericalAbbreviation='3:k;6:M;9:G;12:T;15:P;18:E;21:Z;24:Y;-3:m;-6:μ;-9:n;-12:p;-15:f;-18:a;-21:z;-24:y';
///$tab Test Data
// Data:
// LOAD
// "Date",
// Zone,
// Branch,
// "Type",
// Account,
// CustomerName,
// Status
// FROM [lib://Datasources-CSV/Employee.csv]
// (txt, codepage is 28591, embedded labels, delimiter is ',', msq);
TestData:
LOAD * INLINE [
Region, State, Population
North, Bauchi, 50000
West, Ondo, 12000
South, Cross River, 25000
West, Ogun, 20000
South, Akwa Ibom, 19000
East, Imo, 22000
];
// Exit Script;
///$tab Create Report
ReportType_HTMLTable:
LOAD
Region as [HTMLTable Region],
num(sum(Population), '#,##0') as [HTMLTable Region Population]
RESIDENT TestData
GROUP BY Region
;
NoConcatenate
ReportType_HTMLImage:
LOAD
Region as [HTMLImage Region],
sum(Population) as [HTMLImage Region Population],
round((sum(Population) / 1000), 1/1) as [HTMLImage Region Population Label]
RESIDENT TestData
GROUP BY Region
;
///$tab Create HTML - Table
//create table in HTML
TableOutput:
LOAD
[<!--TableOutput-->]
INLINE [
<!--TableOutput-->
<html>
<head>
<meta http-equiv=refresh content=10>
<style>
tr:first-child td {font-weight: bold;background-color: #dddddd;}
h3 {Font-family: Arial;Font-size: 12pt;}
td {border-left:1px solid #555555;border-top:1px solid #555555;font-family: Arial;font-size:9pt;text-align:left;padding: 2px 10px 2px 10px;}
table {border-right:1px solid #555555;border-bottom:1px solid #555555;border-collapse:collapse;}
</style>
</head>
<body>
<h3>Find the Report Details below</h3>
<table>
<tr><td>Region</td><td>Region Population</td></tr>
];
CONCATENATE(TableOutput)
LOAD
'<tr><td>' & [HTMLTable Region] &
'</td><td>' & replace([HTMLTable Region Population], ',', ',') & '</td></tr>' as [<!--TableOutput-->]
RESIDENT ReportType_HTMLTable
ORDER BY [HTMLTable Region Population] DESC
;
// Append any footer information required to complete the HTML table
CONCATENATE(TableOutput)
LOAD
[<!--TableOutput-->]
INLINE [
<!--TableOutput-->
</table>
</body>
</html>
];
STORE TableOutput INTO [lib://Datasources-HTML/TableOutput.html] (txt);
///$tab Create HTML - Image
//create image chart in HTML
ImageOutput:
LOAD
// replace(
replace('<meta http-equiv=refresh content=10><img src="https://image-charts.com/chart?chbr=0&chco=0080ff&chd=a%3A' & concat([HTMLImage Region Population], '%2C') & '&chdl=Region%20Population&chdlp=r&chl='&concat([HTMLImage Region Population Label], '%7C')&'&chs=700x450&cht=bvs&chtt=Region%20Population&chxl=0%3A%7C' & concat([HTMLImage Region], '%7C') & '&chxs=1N%2A0sz%2A%2C000000&chxt=x%2Cy" alt="Static Chart"/>', '"', '')
// , ',', ',')
as [<!--ImageOutput-->]
RESIDENT ReportType_HTMLImage
;
STORE ImageOutput INTO [lib://Datasources-HTML/ImageOutput.html] (txt);
///$tab Create HTML - Image + Table
// NoConcatenate
//create image chart and table in HTML
HTMLOutput:
LOAD
[<!--HTMLOutput-->]
INLINE [
<!--HTMLOutput-->
<html>
<head>
<style>
tr:first-child td {font-weight: bold;background-color: #dddddd;}
h3 {Font-family: Arial;Font-size: 12pt;}
td {border-left:1px solid #555555;border-top:1px solid #555555;font-family: Arial;font-size:12pt;text-align:left;padding: 2px 10px 2px 10px;}
table {border-right:1px solid #555555;border-bottom:1px solid #555555;border-collapse:collapse;}
</style>
</head>
<body>
<h3>Find the Report Details below</h3>
];
CONCATENATE(HTMLOutput)
LOAD
// replace(
replace('<img src="https://image-charts.com/chart?chbr=0&chco=0080ff&chd=a%3A' & concat([HTMLImage Region Population], '%2C') & '&chdl=Region%20Population&chdlp=r&chl='&concat([HTMLImage Region Population Label], '%7C')&'&chs=700x450&cht=bvs&chtt=Region%20Population&chxl=0%3A%7C' & concat([HTMLImage Region], '%7C') & '&chxs=1N%2A0sz%2A%2C000000&chxt=x%2Cy" alt="Static Chart"/>', '"', '')
// , ',', ',')
as [<!--HTMLOutput-->]
RESIDENT ReportType_HTMLImage
;
CONCATENATE(HTMLOutput)
LOAD
[<!--HTMLOutput-->]
INLINE [
<!--HTMLOutput-->
<table>
<tr><td>Region</td><td>Region Population</td></tr>
];
CONCATENATE(HTMLOutput)
LOAD
'<tr><td>' & [HTMLTable Region] &
'</td><td>' & replace([HTMLTable Region Population], ',', ',') & '</td></tr>' as [<!--HTMLOutput-->]
RESIDENT ReportType_HTMLTable
ORDER BY [HTMLTable Region Population] DESC
;
// Append any footer information required to complete the HTML table
CONCATENATE(TableOutput)
LOAD
[<!--HTMLOutput-->]
INLINE [
<!--HTMLOutput-->
</table>
</body>
</html>
];
STORE HTMLOutput INTO [lib://Datasources-HTML/HTMLOutput.html] (txt);
///$tab Drop Table
// Drop Tables ReportType_HTMLTable, ReportType_HTMLImage;
///$tab Keep
// HTMLOutput:
// LOAD
// // replace(replace([<!DOCTYPE html>], chr(39), '''), chr(44), ',') as [<!DOCTYPE html>]
// // replace([<!DOCTYPE html>], chr(34), '"') as [<!DOCTYPE html>]
// [<!DOCTYPE html>]
// INLINE [
// <!DOCTYPE html>
// <html>
// <head>
// <meta http-equiv=refresh content=10; url=http://localhost:4848/dev-hub/>
// </head>
// <body>
// <p>You will be redirected to example.com soon!</p>
// </body>
// </html>
// ]
// ;