-
Notifications
You must be signed in to change notification settings - Fork 630
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Jean Abou Samra <jean@abou-samra.fr>
- Loading branch information
1 parent
972f618
commit 0ae4bc8
Showing
5 changed files
with
771 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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; | ||
} | ||
} |
Oops, something went wrong.