Sample Method 1:
public server static str getCategory()
{
str viewName = tableStr(SAED_Workers_Dimension);
str sql;
// this is the data source's name,
// which may not be the same as the table name
str SitDirPerson_ds = identifierStr(SitDirPerson_1);
str HcmJob_ds = identifierStr(HcmJob_1);
str NationalityField = fieldStr(SitDirPerson, Nationality);//Table name
str JobField = fieldStr(HcmJob, JobId);//Table name
// to contain the actual SQL column name
str Nationality;
str Job;
// the following will return a string similar to T1.VehicleId
Nationality = SysComputedColumn::returnField(viewName,
SitDirPerson_ds,
NationalityField);
Job = SysComputedColumn::returnField(viewName,
HcmJob_ds,
JobField);
sql = Nationality + "+ '' + " + Job;
return sql;
}
Sample Method2:
public server static str getDeptDimension()
{
str viewName = tableStr(SAED_Workers_Dimension);
str sql;
// this is the data source's name,
// which may not be the same as the table name
str datasourceName = identifierStr(HcmPositionDefaultDimension_1); //Datasource name
str datasourceName1 = identifierStr(SitDirPerson_1); //Datasource name
str DefaultDimensionField = fieldStr(HcmPositionDefaultDimension, DefaultDimension);
str dataAreaFIeld = fieldStr(HcmWorker, DataAreaId);
str partitionField = fieldStr(HcmWorker, Partition);
// to contain the actual SQL column name
str DefaultDimensionId;
str dataAreaId;
str partition;
// the following will return a string similar to T1.VehicleId
dataAreaId = SysComputedColumn::returnField(viewName,
datasourceName1,
dataAreaFIeld);
partition = SysComputedColumn::returnField(viewName,
datasourceName1,
partitionField);
DefaultDimensionId = SysComputedColumn::returnField(viewName,
datasourceName,
DefaultDimensionField);
sql = "SELECT DisplayValue FROM DefaultDimensionView LVS \n";
sql += " WHERE LVS.Name= 'Department' and LVS.DefaultDimension = " + DefaultDimensionId + "\n";
//sql += " AND LVS.DataAreaId = " + dataAreaId + "\n";
sql += " AND LVS.Partition = " + partition + "\n";
return sql;
}
No comments:
Post a Comment