Find a particular Item's product attribute by attibute name and find it's value
Take an item "RawCake". Suppose you have defined in it's product attribute it's an 'eatable' item with its value check marked yes; Now you wanted to know the value of this Product's item attribute value for 'eatable'. Here is that small piece of code that helps in finding it's value;
InventTable InventTableLoc;
EcoResProductAttributeValue ecoResProductAttributeValue;
EcoResAttribute ecoResAttribute;
EcoResValue ecoResValue;
#define.EatableItem("eatable")
select RecId from InventTableLoc where InventTableLoc.itemid =='RawCake'
join RecId from ecoResProductAttributeValue
where ecoResProductAttributeValue.Product == InventTableLoc.Product
join RecId, Name from ecoResAttribute
where ecoResProductAttributeValue.Attribute == ecoResAttribute.RecId
&& ecoResAttribute.Name like #EatableItem
join ecoResValue
where ecoResValue.RecId == ecoResProductAttributeValue.Value;
if (ecoResAttribute.RecId != 0)
{
return ecoResValue.value();
}
No comments:
Post a Comment