Sysadmin>>common>>Users>>Users
Select any current User >> Setup >> Relations . Copy the person, go to HR>> Worker and filter it. Go to employment tab >> Financial dimensions>> Specify the Department.ex :72
Go to PO and assign the same Department 72 with other dimensions diff.
Code to Filter the PO Listpage Based on User Dimension :
PurchTableListPageInteraction >> InitialQuery
container purchIds;
DimensionValue dimvalue;
DimensionProvider dimensionProvider;
DimensionAttributeValueSetStorage dimAttrValueSetStorage;
int i;
else if (this.getListPageType() == PurchTableListPage::NkwWorkerDimensionView)
{
dimensionProvider = new DimensionProvider();
dimAttrValueSetStorage = DimensionAttributeValueSetStorage::find(HcmWorker::find(DirPersonUser::currentWorker()).getDefaultDimension());
for (i = 1; i <= dimAttrValueSetStorage.elements(); i++)
{
if(DimensionAttribute::find(dimAttrValueSetStorage.getAttributeByIndex(i)).Name == "Department")
{
dimvalue = dimAttrValueSetStorage.getDisplayValueByIndex(i);
}
}
qbds = _query.dataSourceTable(tableNum(PurchTable));
qbds.clearDynalinks();
qbds = _query.dataSourceTable(tableNum(PurchTable)).addDataSource(tableNum(PurchLine));
qbds.relations(true);
qbds.joinMode(JoinMode::ExistsJoin);
purchIds = this.getPurchIdWithDep(dimvalue);
if(dimvalue)
qbds.addRange(fieldNum(PurchLine,PurchId)).value(con2Str(purchIds));
else
qbds.addRange(fieldNum(PurchLine,PurchId)).value(sysquery::valueEmptyString());
}
=================================================================
public container getPurchIdWithDep(DimensionValue _depvalue)
{
#define.dimAttr("Department")
#define.dimRangeValue(_depvalue)
Query query = new Query();
QueryRun queryRun;
QueryBuildDataSource queryCustTable;
QueryBuildRange queryDimRange;
PurchLine purchline;
DimensionProvider dimensionProvider;
DimensionAttributeValueSetStorage dimAttrValueSetStorage;
int countLine = 1;
int i;
container conpurchid;
queryCustTable = query.addDataSource(tableNum(PurchLine));
dimensionProvider = new DimensionProvider();
dimensionProvider.addAttributeRangeToQuery(
query,
queryCustTable.name(),
identifierStr(DefaultDimension),
DimensionComponent::DimensionAttribute,
#dimRangeValue,
#dimAttr,
true);
queryRun = new QueryRun(query);
while (queryRun.next()) {
purchline = queryRun.get(tableNum(PurchLine));
dimAttrValueSetStorage = DimensionAttributeValueSetStorage::find(purchline.DefaultDimension);
for (i = 1; i <= dimAttrValueSetStorage.elements(); i++) {
if(DimensionAttribute::find(dimAttrValueSetStorage.getAttributeByIndex(i)).Name == "Department")
{
if(!confind(conpurchid, purchline.PurchId))
conpurchid = conIns(conpurchid,i,purchline.PurchId);
}
}
}
return conpurchid;
}
==============================================================
Select any current User >> Setup >> Relations . Copy the person, go to HR>> Worker and filter it. Go to employment tab >> Financial dimensions>> Specify the Department.ex :72
Go to PO and assign the same Department 72 with other dimensions diff.
Code to Filter the PO Listpage Based on User Dimension :
PurchTableListPageInteraction >> InitialQuery
container purchIds;
DimensionValue dimvalue;
DimensionProvider dimensionProvider;
DimensionAttributeValueSetStorage dimAttrValueSetStorage;
int i;
else if (this.getListPageType() == PurchTableListPage::NkwWorkerDimensionView)
{
dimensionProvider = new DimensionProvider();
dimAttrValueSetStorage = DimensionAttributeValueSetStorage::find(HcmWorker::find(DirPersonUser::currentWorker()).getDefaultDimension());
for (i = 1; i <= dimAttrValueSetStorage.elements(); i++)
{
if(DimensionAttribute::find(dimAttrValueSetStorage.getAttributeByIndex(i)).Name == "Department")
{
dimvalue = dimAttrValueSetStorage.getDisplayValueByIndex(i);
}
}
qbds = _query.dataSourceTable(tableNum(PurchTable));
qbds.clearDynalinks();
qbds = _query.dataSourceTable(tableNum(PurchTable)).addDataSource(tableNum(PurchLine));
qbds.relations(true);
qbds.joinMode(JoinMode::ExistsJoin);
purchIds = this.getPurchIdWithDep(dimvalue);
if(dimvalue)
qbds.addRange(fieldNum(PurchLine,PurchId)).value(con2Str(purchIds));
else
qbds.addRange(fieldNum(PurchLine,PurchId)).value(sysquery::valueEmptyString());
}
=================================================================
public container getPurchIdWithDep(DimensionValue _depvalue)
{
#define.dimAttr("Department")
#define.dimRangeValue(_depvalue)
Query query = new Query();
QueryRun queryRun;
QueryBuildDataSource queryCustTable;
QueryBuildRange queryDimRange;
PurchLine purchline;
DimensionProvider dimensionProvider;
DimensionAttributeValueSetStorage dimAttrValueSetStorage;
int countLine = 1;
int i;
container conpurchid;
queryCustTable = query.addDataSource(tableNum(PurchLine));
dimensionProvider = new DimensionProvider();
dimensionProvider.addAttributeRangeToQuery(
query,
queryCustTable.name(),
identifierStr(DefaultDimension),
DimensionComponent::DimensionAttribute,
#dimRangeValue,
#dimAttr,
true);
queryRun = new QueryRun(query);
while (queryRun.next()) {
purchline = queryRun.get(tableNum(PurchLine));
dimAttrValueSetStorage = DimensionAttributeValueSetStorage::find(purchline.DefaultDimension);
for (i = 1; i <= dimAttrValueSetStorage.elements(); i++) {
if(DimensionAttribute::find(dimAttrValueSetStorage.getAttributeByIndex(i)).Name == "Department")
{
if(!confind(conpurchid, purchline.PurchId))
conpurchid = conIns(conpurchid,i,purchline.PurchId);
}
}
}
return conpurchid;
}
==============================================================
No comments:
Post a Comment