blob: cf19018cae4921c4d96d34c6c28c8123660f5485 (
plain)
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
|
public class ExampleSummaryTmpTable extends common
{
const str TestConstStr = "this_is_a_test";
int Test classInt = 0;
/// <summary>
/// Populates the table with data from hcmWorker, aggregating counts of email domains
/// </summary>
/// <param name="directReportsOnly">
/// Whether to get the whole reporting structure or just direct reports
/// </param>
[Hookable(False)]
public void populateTable(boolean directReportsOnly = true)
{
DirPersonBaseEntity dirPerson;
// Set up Query for Course fetch
QueryRun qr = new QueryRun(new Query());
QueryBuildDataSource qdbsWorker = qr.query().addDataSource(tableNum(HcmWorker));
QueryBuildDataSource qdbsDirPersonEntity = qdbsWorker.addDataSource(tableNum(DirPersonBaseEntity));
qdbsDirPersonEntity.joinMode(JoinMode::InnerJoin);
qdbsDirPersonEntity.addLink(fieldNum(HcmWorker, Person), fieldNum(DirPersonBaseEntity, RecId));
qdbsDirPersonEntity.addOrderByField(fieldNum(DirPersonBaseEntity, BirthYear));
// Setup ranges to include only reporting structure
HcmWorker::rangeFilterReports(HcmWorkerLookup::currentWorker(), qdbsWorker , directReportsOnly);
while (qr.next())
{
// Process each record and add to count in each bucket.
dirPerson = qr.get(tableNum(DirPersonBaseEntity));
if (this.BirthYear != dirPerson.BirthYear)
{
//when finished with a particular birth year, write the aggregate values to the tmp table
this.writeCurrentRecord();
}
this.BirthYear = dirPerson.BirthYear;
if (strFind(dirPerson.PrimaryContactEmail, "@gmail.com"))
{
this.Completed++;
}
else if (strFind(dirPerson.PrimaryContactEmail, "@yahoo.com"))
{
this.Yahoo++;
}
else if (strFind(dirPerson.PrimaryContactEmail, "@outlook.com"))
{
this.Outlook++;
}
else
{
this.Other++;
}
this.Total++;
}
// write last record
this.writeCurrentRecord();
}
private void writeCurrentRecord(){
if(this.BirthYear != "")
{
ttsbegin;
this.write();
ttscommit;
}
this.clear();
this.Gmail = 0;
this.Yahoo = 0;
this.Outlook = 0;
this.Other = 0;
}
}
|