-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathPositionsLookUp.xpp
68 lines (52 loc) · 3.03 KB
/
PositionsLookUp.xpp
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
[DataField]
class PositionId
{
/// <summary>
/// Positions lookup
/// </summary>
/// <param name = "_formControl"></param>
/// <param name = "_filterStr"></param>
public void lookup(FormControl _formControl, str _filterStr)
{
Query query;
QueryBuildDataSource queryBuildDataSourceTable;
QueryBuildDataSource queryBuildDataSourceTableDescriptions;
QueryBuildRange queryBuildRange;
//you need to define the multitable, but initalize it AFTER you have defined the query
//SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(UnitOfMeasure), ctrl);
SysMultiTableLookup sysTableLookup;
query = new Query();
queryBuildDataSourceTable = query.addDataSource(tableNum(HcmPosition));
queryBuildDataSourceTableDescriptions = queryBuildDataSourceTable.addDataSource(tableNum(HcmPositionDetail));
queryBuildDataSourceTableDescriptions.joinMode(JoinMode::InnerJoin);
queryBuildDataSourceTableDescriptions.relations(false);
queryBuildDataSourceTableDescriptions.addLink(fieldNum(HcmPosition,RecId),fieldNum(HcmPositionDetail, Position));
//filter by the unit class being passed
queryBuildRange = queryBuildDataSourceTableDescriptions.addRange(fieldNum(HcmPositionDetail, Department));
queryBuildRange.value(queryValue('!=0'));
//define multiple table lookup query
sysTableLookup = SysMultiTableLookup::newParameters(_formControl, query);
//add which fields will be displayed to the user (symbol + desc.)
sysTableLookup.addLookupfield(fieldNum(HcmPosition, PositionId),true);
sysTableLookup.addLookupfield(fieldNum(HcmPositionDetail, Description), 2);
//do not use for multi table
//sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
/// <summary>
/// Fill job and grade when position is selected
/// </summary>
public void modified()
{
HcmJobList hcmJobList;
HcmCompensationLevelLists hcmCompensationLevelLists;
HcmPosition hcmPosition;
select * from hcmJobList where hcmJobList.PositionId == HcmLabourRequests_PositionId.valueStr();
HcmLabourRequests.JobId = hcmJobList.JobId;
//HcmLabourRequests_JobId.text(hcmJobList.JobId);
//ttscommit;
//info(strFmt('Modified %1 for job %2', HcmLabourRequests_PositionId.valueStr(), hcmJobList.JobId));
select * from hcmCompensationLevelLists where hcmCompensationLevelLists.JobId == HcmLabourRequests_JobId.valueStr();
HcmLabourRequests.Grade = hcmCompensationLevelLists.CompensationLevelId;
}
}