Hi,
Below code is get Product Category for ItemId and display in comma separated if many
public str getProductCategory(ItemId itemId )
{
EcoResProductCategory EcoResProductCategory;
EcoResCategory EcoResCategory,EcoResCategoryNext;
EcoResCategoryId parentCategory;
List li = new List(Types::String);
ListEnumerator enumer;
str categoryName="";
int first=0;
select * from EcoResCategory
join RecId from EcoResProductCategory
where EcoResCategory.RecId == EcoResProductCategory.Category
&& EcoResProductCategory.Product == InventTable::find(itemId).Product;
parentCategory = EcoResCategory.ParentCategory;
while (parentCategory)
{
li.addStart(EcoResCategory.Name);
select * from EcoResCategory
where EcoResCategory.RecId == parentCategory
&& EcoResCategory.ParentCategory != 0; // skip the top node
parentCategory = EcoResCategory.ParentCategory;
}
enumer = li.getEnumerator();
while (enumer.moveNext())
{
if(first==0)
{
categoryName = enumer.current();
first=1;
}
else
{
categoryName =categoryName + ", " + enumer.current();
}
}
return categoryName;
}
Or
Try to Use below
InventTable _inventTable;
AnyTempTable anyTempTable;
anyTempTable.categoryName = _inventTable.categoryName ();
i.e. from
/// <summary>
/// Display the category name of the selected category record.
/// </summary>
/// <returns>
/// The category name that was selected from the category lookup.
/// </returns>
public display EcoResCategoryName categoryName()
{
return EcoResProductCategory::findCategoryByProduct(_inventTable.Itemid).Name;
}
Fetching IntrastatCommodity for Item which is reference field.
EcoResCategory::find(_inventTable.IntrastatCommodity).Code ;
/// <summary>
///
/// </summary>
display Str60 CommodityCode()
{
InventTable inventTable=InventTable::find(this.ItemId);
str60 CommodityCode;
CommodityCode =EcoResCategory::find(inventTable.IntrastatCommodity).Code ;
return CommodityCode;
}
Fetching Multiple - Released product>Default order settings button>Stock quantity>Multiple
_inventTable.inventItemInventSetup("AllBlank").MultipleQty ;
Fetching StorageDimensionGroup, TrackingDimensionGroup,
Finance dimensionDiscription, Finance dimension DisplayValue
EcoResStorageDimensionGroupRecId storageDimensionGroupRecid;
storageDimensionGroupRecid=_inventTable.storageDimensionGroup();
EcoResStorageDimensionGroup::find(storageDimensionGroupRecid).Name ;
EcoResTrackingDimensionGroupRecId trackingDimensionGroupRecId;
trackingDimensionGroupRecId=_inventTable.trackingDimensionGroup ();
EcoResTrackingDimensionGroup::find(trackingDimensionGroupRecId).Name ;
select firstOnly defaultDimensionView join _inventTable
where defaultDimensionView.DefaultDimension == _inventTable.DefaultDimension && _ecoResProduct.productNumber() ==_inventTable.ItemId
join dimensionAttribute where defaultDimensionView.Name == dimensionAttribute.Name
&& defaultDimensionView.Name =="Product"; //Product in UAT
ProductDimensionName=defaultDimensionView.dimensionDiscription();
ProductDimensionName=defaultDimensionView.DisplayValue;
For Purchase Category
EcoResCategory::find(purchLine.ProcurementCategory).Name;
OR
public EcoResCategoryName Category(ItemId _itemId)
{
EcoResProductCategory ecoRedProductCat;
EcoResCategory ecoResCat;
EcoResCategoryHierarchy ecoResCatHierarchy;
EcoResCategoryHierarchyRole ecoResCatHRole;
select ecoResCat
join ecoRedProductCat where ecoRedProductCat.Product == Inventtable::find(_itemid).Product &&
ecoResCat.RecId == ecoRedProductCat.Category
join ecoResCatHierarchy where ecoResCatHierarchy.RecId == ecoResCat.CategoryHierarchy
join ecoResCatHRole where ecoResCatHRole.CategoryHierarchy == ecoResCatHierarchy.RecId &&
ecoResCatHRole.NamedCategoryHierarchyRole == EcoResCategoryNamedHierarchyRole::Procurement;
return ecoResCat.Name;
}
Below code is get Product Category for ItemId and display in comma separated if many
public str getProductCategory(ItemId itemId )
{
EcoResProductCategory EcoResProductCategory;
EcoResCategory EcoResCategory,EcoResCategoryNext;
EcoResCategoryId parentCategory;
List li = new List(Types::String);
ListEnumerator enumer;
str categoryName="";
int first=0;
select * from EcoResCategory
join RecId from EcoResProductCategory
where EcoResCategory.RecId == EcoResProductCategory.Category
&& EcoResProductCategory.Product == InventTable::find(itemId).Product;
parentCategory = EcoResCategory.ParentCategory;
while (parentCategory)
{
li.addStart(EcoResCategory.Name);
select * from EcoResCategory
where EcoResCategory.RecId == parentCategory
&& EcoResCategory.ParentCategory != 0; // skip the top node
parentCategory = EcoResCategory.ParentCategory;
}
enumer = li.getEnumerator();
while (enumer.moveNext())
{
if(first==0)
{
categoryName = enumer.current();
first=1;
}
else
{
categoryName =categoryName + ", " + enumer.current();
}
}
return categoryName;
}
Or
Try to Use below
InventTable _inventTable;
AnyTempTable anyTempTable;
anyTempTable.categoryName = _inventTable.categoryName ();
i.e. from
/// <summary>
/// Display the category name of the selected category record.
/// </summary>
/// <returns>
/// The category name that was selected from the category lookup.
/// </returns>
public display EcoResCategoryName categoryName()
{
return EcoResProductCategory::findCategoryByProduct(_inventTable.Itemid).Name;
}
Fetching IntrastatCommodity for Item which is reference field.
EcoResCategory::find(_inventTable.IntrastatCommodity).Code ;
/// <summary>
///
/// </summary>
display Str60 CommodityCode()
{
InventTable inventTable=InventTable::find(this.ItemId);
str60 CommodityCode;
CommodityCode =EcoResCategory::find(inventTable.IntrastatCommodity).Code ;
return CommodityCode;
}
Fetching Multiple - Released product>Default order settings button>Stock quantity>Multiple
_inventTable.inventItemInventSetup("AllBlank").MultipleQty ;
Fetching StorageDimensionGroup, TrackingDimensionGroup,
Finance dimensionDiscription, Finance dimension DisplayValue
EcoResStorageDimensionGroupRecId storageDimensionGroupRecid;
storageDimensionGroupRecid=_inventTable.storageDimensionGroup();
EcoResStorageDimensionGroup::find(storageDimensionGroupRecid).Name ;
EcoResTrackingDimensionGroupRecId trackingDimensionGroupRecId;
trackingDimensionGroupRecId=_inventTable.trackingDimensionGroup ();
EcoResTrackingDimensionGroup::find(trackingDimensionGroupRecId).Name ;
select firstOnly defaultDimensionView join _inventTable
where defaultDimensionView.DefaultDimension == _inventTable.DefaultDimension && _ecoResProduct.productNumber() ==_inventTable.ItemId
join dimensionAttribute where defaultDimensionView.Name == dimensionAttribute.Name
&& defaultDimensionView.Name =="Product"; //Product in UAT
ProductDimensionName=defaultDimensionView.dimensionDiscription();
ProductDimensionName=defaultDimensionView.DisplayValue;
For Purchase Category
EcoResCategory::find(purchLine.ProcurementCategory).Name;
OR
For get product-category Descendants example
public FreeText getDecendants(ItemId _itemid)
{
str Decendants;
EcoResProductCategory ecoResProductCategory;
EcoResCategory ecoResCategory;
EcoResCategory ecoResCategoryAscendants;
select firstOnly ecoResProductCategory
where
ecoResProductCategory.Product==EcoResProduct::findByProductNumber(_itemid).RecId;
select firstOnly ecoResCategory where ecoResCategory.RecId==ecoResProductCategory.Category;
Decendants = ecoResCategory.Name;
while
select * from ecoResCategoryAscendants
order by ecoResCategoryAscendants.NestedSetRight
where ecoResCategoryAscendants.CategoryHierarchy == EcoResCategory.CategoryHierarchy
&& ecoResCategoryAscendants.NestedSetLeft < EcoResCategory.NestedSetLeft
&& ecoResCategoryAscendants.NestedSetRight > EcoResCategory.NestedSetRight
{
Decendants = strFmt(
"%1-%2"
,ecoResCategoryAscendants.Name,Decendants);
}
return
Decendants;
}
OR Get Procurement category
ocdePfronke Justin Miller https://wakelet.com/wake/CYtBZ2G1kswnUebKfQKMe
ReplyDeletecourtdustmillsupp