For the past few days, I've been trying to retrieve the value of the configuration model associated with a product number if such a configuration model exists. I think I've finally succeeded. As far as I could tell, I couldn't find any detailed information on this topic, so I wanted to note it here in case it might be useful to you.
EcoResProduct ecoResProduct;
PCProductModelVersion pcProductModelVersion;
PCProductConfigurationModel pcProductConfigurationModel;
EcoResCategory ecoResCategory;
EcoResCategoryAttribute ecoResCategoryAttribute;
EcoResAttribute ecoResAttribute;
ECORESVALUE ecoresvalue;
EcoResEnumerationAttributeTypeValue ecoresenumerationattributetypevalue;
EcoResAttributeType ecoresattributetype;
EcoResTextValue ecorestextvalue;
while select ecoResProduct
where ecoResProduct.DisplayProductNumber == _inventTable.ItemId // you can enter the item code you want here.
join pcProductModelVersion
where pcProductModelVersion.ProductMaster == ecoResProduct.RecId
&& pcProductModelVersion.IsActive == NoYes::Yes
join pcProductConfigurationModel
where pcProductConfigurationModel.RecId == pcProductModelVersion.Model
join ecoResCategory
where ecoResCategory.RecId == pcProductConfigurationModel.RootComponentClass
join ecoResCategoryAttribute
where ecoResCategoryAttribute.Category == ecoResCategory.RecId
join ecoResAttribute
where ecoResAttribute.RecId == ecoResCategoryAttribute.Attribute
join ecoresattributetype
where ecoresattributetype.RecId == ecoResAttribute.AttributeType
join ecoresenumerationattributetypevalue
where ecoresenumerationattributetypevalue.AttributeType == ecoresattributetype.RecId
join ecoresvalue
where ecoresvalue.RecId == ecoresenumerationattributetypevalue.Value
join ecorestextvalue
where ecorestextvalue.RecId == ecoresvalue.RecId
{
//some logic here...
}
Caution !!
You cannot access the 'ecorestextvalue' table in SQL.
If you want to run it in SQL, remove the relevant line.
SQL:
select ep.RECID,pmv.MODEL,pcm.NAME,erc.NAME,eca.NAME,ecatv.VALUE,* from ECORESPRODUCT ep
join PCPRODUCTMODELVERSION pmv on ep.RECID = pmv.PRODUCTMASTER and pmv.ISACTIVE =1
join PCProductConfigurationModel pcm on pcm.RECID = pmv.MODEL
join ECORESCATEGORY erc on erc.RECID = pcm.ROOTCOMPONENTCLASS
join ECORESCATEGORYATTRIBUTE erca on erca.CATEGORY = erc.RECID
join ECORESATTRIBUTE eca on eca.RECID = erca.ATTRIBUTE
join EcoResAttributeType ecat on ecat.RECID = eca.ATTRIBUTETYPE
join EcoResEnumerationAttributeTypeValue ecatv on ecatv.ATTRIBUTETYPE = ecat.RECID
join ECORESVALUE erv on erv.RECID = ecatv.VALUE
where ep.DisplayProductNumber='102198' //itemId here.