Tuesday 17 February 2015

Product Attribute Value


Feed the method with an itemid and the attribute name and get back the value of the attribute (if it exists)


public str getProductAttribute(ItemId _itemId, Name _attributeName)
{
    inventTable                 InventTable;
    EcoResProductAttributeValue ecoResProductAttributeValue;
    EcoResAttribute             ecoResAttribute;
    EcoResValue                 ecoResValue;

     select InventTable where InventTable.itemid == _itemId
        join RecId from ecoResProductAttributeValue
        where ecoResProductAttributeValue.Product == InventTable.Product
            join Name from ecoResAttribute
            where ecoResProductAttributeValue.Attribute == ecoResAttribute.RecId &&
                  EcoResAttribute.Name == _attributeName
                join ecoResValue
                where ecoResValue.RecId == ecoResProductAttributeValue.Value;

    return ecoResValue.value();

}

No comments:

Post a Comment