Eval – Calculations within the modify statement

General

If a rule is applied, the eval statements recalculate the attributes of matched and inserted graph elements.

Example code:

//This rule calculates the profit of a product by the subtraction of the product cost from the product sales price
1 rule calculateProfitProductFamilies {

2    pf:ProductFamily -:IsFamilyOf-> p:Product;					//find Products connected to ProductFamily
	
3    modify{
4       eval{
5          pf.profit = pf.profit + p.profit*p.salesvolume;		//Sum up profit of products times sales volume of product for product family
6          pf.salesvolume = pf.salesvolume + p.salesvolume;	//Sum up sales volume of products for product family
7 	}
8    }
9 }

This code example can be found in our Soley Studio Tutorial.

How to use it:

More Examples can be found in these Packages:

BoM-Kit

Was this article helpful?

Related Articles