This repository has been archived on 2024-06-20. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
coffee.pygments/tests/examplefiles/xpp/test.xpp
Andrew Schmidt 0ae4bc83d3
Add X++ support (#2339)
Co-authored-by: Jean Abou Samra <jean@abou-samra.fr>
2023-02-14 19:29:42 +01:00

76 lines
No EOL
2.5 KiB
Text

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;
}
}