Administration - Smart Quote Rule Facts (Attributes)
Rule Facts are how you access attribute values and customer data within the Smart Quote Rules engine.
While Attribute Setup defines what an attribute is, Rule Facts define how the rules see them.
Customer Facts
Customer facts can be used in the rules, often in situations where pricing is defined by customer, pricing tier, etc.
- CustomerFact
- CustomerAttributeFact
Example - CustomerFact
when
var config = Configurator();
// first line is AND(ed) with the second (both must be true)
var cust = CustomerFact(x => x.Name == "CUST1" );
// if all lines in when block are true...then block is executed
then
config.LogInformation("Info...");
Example - CustomerAttributeFact
when
var config = Configurator();
// first line is AND(ed) with the second (both must be true)
var cust = CustomerAttributeFact(x => x.Name == "ATTR1" && x.Value == "VALUE" );
// if all lines in when block are true...then block is executed
then
config.LogInformation("Info...");
Product Facts/Attributes
Types
- Text : Attribute_TXT
- Integer : Attribute_INT
- Double : Attribute_DOUBLE
- Dimension : Attribute_DIM
- Area : Attribute_AREA
- Volume : Attribute_AREA
- Weight : Attribute_WEIGHT
Text
Example - Attribute_TXT
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("Info...");
Integer
Example - Attribute_INT
when
var config = Configurator();
// first line is AND(ed) with the second (both must be true)
var attr = Attribute_INT(x => x.NameIs("ATTR1") && x.Int() == 5 );
// if all lines in when block are true...then block is executed
then
config.LogInformation("Info...");
Double
Example - Attribute_DOUBLE
when
var config = Configurator();
// first line is AND(ed) with the second (both must be true)
var attr = Attribute_DOUBLE(x => x.NameIs("ATTR1") && x.Value() == 5.0m );
// if all lines in when block are true...then block is executed
then
config.LogInformation("Info...");
Dimension
Example - Attribute_DIM
The units of the attribute are defined in the Setp (ADMIN) area. Can be: IN, FT, MM, M.
when
var config = Configurator();
// first line is AND(ed) with the second (both must be true)
var attr = Attribute_DIM(x => x.NameIs("ATTR1") && x.Value() == 5.0m );
// if all lines in when block are true...then block is executed
then
config.LogInformation("Info...");
Area
Example - Attribute_AREA
The units of the attribute are defined in the Setp (ADMIN) area. Can be: IN^2, FT^2, MM^2, M^2.
when
var config = Configurator();
// first line is AND(ed) with the second (both must be true)
var attr = Attribute_AREA(x => x.NameIs("ATTR1") && x.Value() == 5.0m );
// if all lines in when block are true...then block is executed
then
config.LogInformation("Info...");
Volume
Example - Attribute_VOL
The units of the attribute are defined in the Setp (ADMIN) area. Can be: IN^3, FT^3, MM^3, M^3.
when
var config = Configurator();
// first line is AND(ed) with the second (both must be true)
var attr = Attribute_VOL(x => x.NameIs("ATTR1") && x.Value() == 5.0m );
// if all lines in when block are true...then block is executed
then
config.LogInformation("Info...");
Weight
Example - Attribute_WEIGHT
The units of the attribute are defined in the Setp (ADMIN) area. Can be: LB, KG, G.
when
var config = Configurator();
// first line is AND(ed) with the second (both must be true)
var attr = Attribute_WEIGHT(x => x.NameIs("ATTR1") && x.Value() == 5.0m );
// if all lines in when block are true...then block is executed
then
config.LogInformation("Info...");