Administration - Smart Quote / Product / Rules / Functions
Booleans
when
// is ATTR1 present?
var attr = Attribute_TXT(x => x.NameIs("ATTR1") );
// AND is ATTR2 present?
var attr2 = Attribute_TXT(x => x.NameIs("ATTR2") );
// AND is Configurator present + check values
var config = Configurator(
(attr1.ValueIs("VAL1") || attr1.ValueIs("VAL2"))
&&
(attr2.ValueIs("TEST")
)
);
// if all lines in when block are true...then block is executed
then
config.AddTask("PROCESS").Time(5m).Detail("Machine to print").AddResource("RES_01");
Log Information
when
var config = Configurator();
// first line is AND(ed) with the second (both must be true)
var attr = Attribute_TXT(x => x.NameIs("ATTR1") && x.ValueIs("") );
// if all lines in when block are true...then block is executed
then
config.LogInformation("Attribute 1 is blank and recommended");
Log Warning
when
var config = Configurator();
var attr = Attribute_TXT(x => x.NameIs("ATTR1") && x.ValueIs("") );
then
config.LogWarning("Attribute 1 is blank (required)");
Log Error
when
var config = Configurator();
var attr = Attribute_TXT(x => x.NameIs("ATTR1") && x.ValueIs("") );
then
config.LogError("Attribute 1 is blank (required)");
Add Attribute
when
var config = Configurator();
var attr = Attribute_TXT(x => x.NameIs("ATTR1") && x.ValueIs("123") );
then
config.AddAttribute("ATTR2", "New Value");
Add Item
when
var config = Configurator();
var attr = Attribute_TXT(x => x.NameIs("ATTR1") && x.ValueIs("123") );
then
// MATERIAL1 must exist in the Item catalog. Error is thrown if not
config.AddItem("MATERIAL1", 2.0m); // quantity of 2 (m is syntax for decimal number)
Add Task
when
var config = Configurator();
var attr = Attribute_TXT(x => x.NameIs("ATTR1") && x.ValueIs("123") );
then
config.TaskAdd("TASK1");
// Additional chained functions available with Add Task (can appear in any combination or sequence):
// config.TaskAdd("TASK1").Detail("Turn to 2 inches OD");
// config.TaskAdd("TASK1").Time(5m); // Set time to 5 min
// config.TaskAdd("TASK1").Cost(0m); // Set cost to 5 min. Overrides calculated cost (time * total shop rate)
// config.TaskAdd("TASK1").Price(0m); // Set price to 0. Overwides calculated price (cost * markup)
// config.TaskAdd("TASK1").Detail("Turn to 2 inches OD").Cost(0m).Price(0m); // Set price to 0. Overwides calculated price (cost * markup)
Set Detail
Override detail defined in Tasks (Setup)
when
var config = Configurator();
then
config.TaskAdd("TEST1").Detail("Machine to Print");
Set Cost
Override Cost (from Calculated Cost via Task Setup)
when
var config = Configurator();
then
config.TaskAdd("HEATTREAT").Cost(300m);
Set Price
Override Price (from Calculated Price via Task Setup)
when
var config = Configurator();
then
config.TaskAdd("HEATTREAT").Price(300m);
Pricing Component
Override the pricing component definition for Tasks and Items.
when
var config = Configurator();
then
config.TaskAdd("TEST").PricingComponentSet("Option 1");
config.TaskAdd("Item1", 1.0m).PricingComponent("Option 1");
Add Document
Add a Document from the Product Documents list (Setup)
when
var config = Configurator();
then
config.TaskAdd("TEST1").DocumentAddByName("Doc1Name");
config.TaskAdd("TEST1").DocumentAddByID("adfasdf");
Item Category
Override the category for an item (defined in Items).
when
var config = Configurator();
then
config.AddItem("Item1", 1.0m).Category("Option 1");
Add Resource
If a Resource is not specified in a Rule, the Default Resource will be added. See the Scheduler for details about how Tasks and Resources relate.
when
var config = Configurator();
then
config.TaskAdd("TEST1").AddResourceByName("TECH_01");
config.TaskAdd("TEST1").AddResourceByID("46372FF2-7B0D-48DA-B153-C88376B7BA5D");
Add Document (To Task)
Add a document to the task which will be copied to the Line Item and carried through to the Production Order. The Task document(s) are displayed on the Production Order Task Detail view. The document must exist on the Product definition - otherwise an error will occur.
when
var config = Configurator();
then
config.TaskAdd("MACH01").AddDocumentByName("Test Document"); // name must match (rule breaks if name on document changed)
config.TaskAdd("MACH01").AddDocumentByID("B48CC25B-10D2-48A2-B715-1FE57031308E"); // name changes don't affect
Add Link (To Task)
Add a link to the task which will be copied to the Line Item and carried through to the Production Order. The Task links are displayed on the Production Order Task Detail view. The links must be accessible from user's current network (private links won't be accessible when at a different location).
when
var config = Configurator();
then
config.TaskAdd("MACH01").AddLink("Velosity", "https://www.velosity.app");
Adjust Router Cost
Adjusts all cost in the router for steps already added. Steps added after this are not affected. Useful when costs needed to be overriden for the entire (to this point) router.
when
var config = Configurator();
then
config.TasksCostFactor(1.1m); // multiply all task prices by 1.1
config.ItemsCostFactor(1.1m); // multiply all item prices by 1.1
Adjust Pricing
Adjusts all pricing in the configuration for steps and items already added. Steps added after this are not affected. Useful when prices needed to be overriden for the entire (to this point) configuration. To apply to the entire configuration, make this the last rule in the rule set.
when
var config = Configurator();
then
config.TasksPriceFactor(1.1m); // multiply all task prices by 1.1
config.ItemsPriceFactor(1.1m); // multiply all item prices by 1.1
Allow Add to Sales Quote
Override Product setting. This is useful when certain products should only be added to Sales Orders - skipping the Quote phase
when
var config = Configurator();
then
config.AddToSalesQuoteAllowed(false); // disable
Allow Add to Sales Order
Override Product setting. This is useful when certain products should only be added to Sales Quotes - skipping the Order phase
when
var config = Configurator();
then
config.AddToSalesOrderAllowed(false); // disable
Add Note
Add Note which will be copied to the Line Item when added to a Sales Quote or Sales Order.
when
var config = Configurator();
then
config.AddNote("This is a test note");
Set Description
Set description which will be copied to the Line Item when added to Sales Quote or Sales Order.
when
var config = Configurator();
then
config.DescriptionSet("This is a test description");
Quantity - Add or Set
Add (increment) quantity which will be copied to the Line Item when added to Sales Quote or Sales Order.
when
var config = Configurator();
then
config.QuantitySet(2.0m);
config.QuantityAdd(0.5);
Dimensions & Weight - Add or Set
Set the dimensions of the configuration which will be copied to the Line Item when added to Sales Quote or Sales Order.
when
var config = Configurator();
then
config.LengthSet(2.5m);
config.LengthAdd(0.5m);
//
config.WidthSet(2.5m);
config.WidthAdd(0.5m);
//
config.HeightSet(2.5m);
config.HeightAdd(0.5m);
//
config.WeightSet(1.5m);
config.WeightAdd(0.5m);
Add Document (To LineItem)
Add a document to the configuration which will be copied to the Line Item when added to Sales Quote or Sales Order. The document must exist on the Product definition - otherwise an error will occur.
when
var config = Configurator();
then
config.AddDocument("Test Document"); // name must match (rule breaks if name on document changed)
config.AddDocumentByID("B48CC25B-10D2-48A2-B715-1FE57031308E"); // name changes don't affect
Evaluate Total Cost
This example shows how to evaluate the total cost of the configuration. If the total cost is between 1500 and 3000 and WARRANTY is OUTOFWARRANTY then: 1) set the TIER attribute to 2, 2) set all prices to 0, 3) add item called REPAIRFEE.TIER1. This Item must exist or an error will be thrown.
when
var config = Configurator(x => x.TotalCost() >= 1500m && x.TotalCost() < 3000m); // ** m means decimal format
var warranty = Attribute_TXT(x => x.NameIs("WARRANTY") && x.ValueIs("OUTOFWARRANTY") );
then
config.AddAttribute("TIER", "2"); // type TEXT
config.TasksPriceFactor(0m); // set all prices to zero
config.AddItem("REPAIRFEE.TIER1", 1.0m);
Evaluate Total Price
This example shows how to evaluate the total price of the configuration to provide a discount. If the total cost is between 1500 and 3000 and WARRANTY is OUTOFWARRANTY then: 1) set the TIER attribute to 2, 2) set all prices to 0, 3) add item called REPAIRFEE.TIER1. This Item must exist or an error will be thrown.
when
var config = Configurator(x => x.TotalPrice() >= 1500m && x.TotalPrice() < 3000m); // ** m means decimal format
then
config.TasksPriceFactor(0.95m); // add 5% discount
config.ItemsPriceFactor(0.95m); // add 5% discount
Booleans
Boolean logic can be used when evaluating Attribute properties. It is important to adhere to boolean order of operations (use parentheses to control order).
Example: A + B * C is not the same as (A + B) * C
when
var config = Configurator();
// find an Attribute of type TEXT and having name PRODUCT and values VAL1 or VAL2
var attr = Attribute_TXT(x => x.NameIs("PRODUCT") &&
(
x.ValueIs("VAL1")
|| x.ValueIs("VAL2")
)
);
then
config.AddTask("CS_TECH_01").Detail("Machine to print").Time(30m);