Create an External Rule
You can create rules defined at the Library level: They are called by their names, and a list of arguments corresponding to their signatures.
The external rule is created.
 Create an External RuleYou can create rules defined at the Library level: They are called by their names, and a list of arguments corresponding to their signatures. The external rule is created. Create a Local RuleYou can create local rules that enable you to access the attributes and the children of the current concept.  
			   In the 
				Know-how Apps Logic Editor, enter the
				following script: 
			  
			  
Rule "CreateTableChildren"
       {
           /* This rule creates the Table Top and Foot children and passes on the inputs when possible */
           if tableGeometry == "Round"
                          tableTop = new("MyRoundTableTop","tableTop",this,2cm,topReference)
           else
                          tableTop = new("MyRectangularTableTop","tableTop",this,2cm,topReference)
           tableFoot = new("MyTableFoot","tableFoot",this,tableHeight-2cm,footRadius)
       } 
			 The internal Rule is created. A name (CreateTableChildren in the above example) can be attributed to the rule to make it easier to locate errors at instantiation. This name is optional. Create an Event-Triggered RuleYou can create Event-Triggered Rules: On Init Rules and On Valuation Rules. On Init Rules can be used to do a pre-treatment on KML Objects instantiated from the Concept. They are executed as soon as the KML Object is created. On Valuation Rules can be used to do a post-valuation treatment on a set of attributes. They are executed only when all inputs and specified attributes are evaluated on an object. You Rules are created. Use the On Condition Keyword in RulesThe  Concept FuelType : BaseConcept
{
                 Object : VoidType;
                 Attributes
                 {
                           Inputs
                           {
                                   String engineType { "Diesel", "Gas" };
                                   Integer productionYear;
                           }
                           Outputs
                           {
                                   String fuelType { "Diesel", "Gas", "Ethanol"};
                           }
                  }
                  Rules
                  {
                            Rule on Condition engineType == "Diesel"
                            {
                                    fuelType = "Diesel"
                            }
                            Else if engineType == "Gas" AND productionYear > 2000
                            {
                                    fuelType = "Ethanol"
                            }
                            Else
                            {
                                     fuelType = "Gas"
                             }
                  }
}    In the above example, if the engine type is "Diesel" no value is required for "productionYear" and the first rule is launched. If another engine type was selected, the "productionYear" is valuated. 
Create a Rule Integrating a Knowledge DialogWhen editing a KML Library, you can add a Dialogs subpart to the Rules section of your Concept. The syntax is the following: Rules
{
               Dialogs
               {
                       DialogName ( dialogAttr1 = conceptAttr1;
                                        dialogAttr2 = conceptAttr2;
                          );
                          ...
               }
}
                                               ...
 
		Note:
			The Knowledge dialog you want to use is identified by its name.
		  Dialogs are retrieved from the Know-how Apps
				  component of the library and from all
		  its prerequisites components. The attributes of the Dialog are bound to the
		  Concepts attributes (for example conceptAttr1 will be bound to dialogAttr1).
		  The fact that they are declared as input or output in the Dialog is checked by
		  the KML engine and the information is used to determine if the dialog is an
		  attribute evaluator or if this attribute must be evaluated beforehand. 
		 
 
		To view an example, import the  Creating a Rule Containing a FilterYou can define filters to apply to inputs in your KML script. In the Rule section, you can insert a filter block and determine which inputs are filtered by the KML rule thus making the instantiation easier. Filters can be used to: 
 
 The filter is created.  | |||||||||