Selecting a LanguageYou can select a language. When defining rules in Knowledge Expert, you can use two languages:
When defining checks in Knowledge Expert, you may use three languages:
Declaring VariablesYou can declare Variables. in the For All field
Note that:
In the Check BodyTemporary variables can be declared by using the keyword. A temporary variable does not persist as a parameter after the check/rule execution is finished.
Using TypesYou can use Types. The types described below are those you can use in the Expert Rule Editor or in the Expert Check Editor by using the Object Browser. In the
Idenntifier:type_name
Using Types AttributesYou can use Types Attributes. The types attributes described below are those you can select in the Object Browser available from the Expert Rule Editor or the Expert Check Editor. Types are allocated attributes that you can key in in the check or rule body or that you can select in the Language Browser.
type_identifier.object_name Example: if H.Diameter > 10.0 then H.Activity = False Using FunctionsFunctions supported by Knowledge Expert may be entered manually in the check or rule body or can be selected from the Object Browser (See description above to know how to access the browser.)
Using StatementsYou can use Statements. Note: The control structures described below are the one you can use in the Expert Rule Editor or in the Expert Check Editor. Any script is built out of a series of statements. A statement can be an assignment, a function call, or a conditional statement. Statements usually end with a semicolon. In addition, statements can be grouped into a statement-group by encapsulating a group of statements within curly braces. You can use the single-line form (first syntax) for short, simple rules. However, the block form (second syntax) provides more structure and flexibility than the single-line form and is usually easier to read, maintain, and test. The else and else if clauses are both optional. You can have as many else if statements as you want below a block if, but none can appear after the else clause. Block if statements can be nested that is, contained within one another. If ConstructThis construct allows for conditional execution of code fragments. Note that "if" constructs cannot be nested. if(Hole.HoleType == "Simple") { Hole.Diameter = 24mm; } Note:
if condition statements [else elsestatements ] or if condition { statements } [else if condition-n [ { elseifstatements } ] ] . . . [else [ { elsestatements } ] ] Rules: if ... else ... else ifConditionally executes a group of statements, depending on the value of an expression. You can use either block form syntaxes: You can use the single-line form (first syntax) for short, simple rules. However, the block form (second syntax) provides more structure and flexibility than the single-line form and is usually easier to read, maintain, and test. The else and else if clauses are both optional. You can have as many else if statements as you want below a block if, but none can appear after the else clause. Block if statements can be nested that is, contained within one another. Checksstatement1 => statement2 (if statement1 then statement2) Displays a message (if type is Warning or Information) and turns to red in the specification tree each time statement2 is invalid as statement1 is fulfilled. if ... then ... else ConstructNote that the if...then...else construct is only available for checks created using the Knowledge Advanced Language, and for rules. In this case, use the Knowledge Language. if then else statements are used for conditional computation. The else statement is optional. Statements can be nested that is, contained within one another. while ConstructNote that the while construct is only available for checks created using the Knowledge Advanced Language and for rules. In this case, use the Knowledge Language. while loops are used to execute a statement if an expression evaluates to true. ![]() for ConstructNote that the for construct is only available for checks created using the Knowledge Advanced Language and for rules. In this case, use the Knowledge Language. for executes a loop based on the element of a list. See syntax opposite. It executes a statement Nth times where N is the number of elements of the list. In the example above:
In the example below:
Using OperatorsYou can use Operators. Arithmetic operators+ Addition operator (also concatenates strings) - Subtraction operator * Multiplication operator / Division operator Comparison Operators<> Not equal to == Equal to >= Greater or equal to <= Less than or equal to < Less than > Greater than Filter OperatorThe Filter Operator (=>) is designed for implication: It enables you to restrict the check operation on a subset of the features that were specified in the For all field: |