inrule technology logo

The Premier Rule Engine for .NET

Search Home | Contact Us

FAQs

Main Topic Question
Licensing

Why am I getting a trial license expired error.

How do I create a LICENSE file

Questions related to .NET Class

Use static functions in InRule

Use Instance Methods in InRule

How to use custom objects in irSDK

XML/XSD related questions

How do I bind my XSD data

How do I use xml namespaces within InRule

Webservice

Use InRule as a webservice

Web application

How to use InRule in a web application scenario

irVerify

How to disable entity field comments to show up in irVerify

Web Service Certificate Override

How to override the certificate path from code

Serialize InRule Object to XML

How to serialize InRule object (for eg. RuleExecutionLog) to XML

Logging

How does InRule handle logging

Compiler Errors

How to look for compiler errors via SDK

Threading

Can two threads simultaneously use the same RuleApplicationDef

Access value list items via irSDK

How to access valuelist items via irSDK

Catalog instance

How many instances of catalog does any installer install

Is there a way to install /upgrade all instances of catalog at once

Halt Ruleset

How can I halt the ruleset currently executing

Catalog

How do I remove rule applications from the Catalog

How do I increase catalog service connection time

Schemas via irSDK

How do I get all the schemas defined in a ruleapp

Query against Inline table

Are complex queries supported for inline table

Rule Authoring

Question. How do I know which Ruleset fire mode and run mode I should use?

Question. Why are some actions unavailable for Optimized rulesets?

Question. What does "activated by default" mean in the Ruleset definition screen?

Question: Why would I use the "Single-Pass Sequential" run mode?

Question. Can I call an Auto Sequential ruleset using ExecuteRuleset?

Question. When should I use a Calculation vs a Ruleset?

Question. When should I use a Decision Table?

Question. When should I use a Language Rule vs a Syntax Rule?

Question. When should I check the "cascade parent context" checkbox?

Question. When should I use a Classification?

Question. When should I use Notifications

Question. Why do I sometimes see a "Submit" button in irVerify, but not always?

Question. How do I use a variable with a business language rule?

Question. How do I refer to individual collection members in a "do while" loop?

   

 

Licensing

Why am I getting a trial license expired error.

This error occurs because the embedded trial date in the InRule build would have expired.
You need to deploy the inrule.lic file with your application.

Deployment Process:
It may be deployed to the directory where the binaries are, -or- to another directory specified by the following .config entry:

<add key="InRule.Licensing.LicenseFolder" value="ABS.OR.REL.PATHTOYOURLICENSEFOLDER" />


The inrule.lic file is created by your InRule install at : \InRule\InRuleSuite\LicenseFile\
(assuming you entered your InRule serial # during or after the install).

Recommendation:
We also recommend you add code to your application to determine if this license file was found.
This helps ensure that you don't have surprises when an embedded trial date from a recent InRule build expires.


The snippet below demonstrates how to do this:

[Test]
public void VerifyTrialLicenseIsRetrievedForRuleApplicationDef()
{
LicenseInfo info = RuleRepositoryServices.GetLicenseInfo();
Debug.WriteLine(info.IsTrial.ToString() ); //True if lic file not found, false if found
Debug.WriteLine(info.Expires); //Expire date (whether trial or license-file).
}


If deploying to the directory where the binaries are, a good approach is to have the inrule.lic file in the root of your VS.NET project , then use a VS.NET post-build event to copy it to the output (binaries) directory.

Note: Other errors encountered: License folder not specified (Refer to next question)

Go to top

How do I create a LICENSE file

During Installation:
User is promoted to enter serial number during Installation of the product. License Folder is created in InRuleSuite\InRule directory. This folder contains the license file.

After Installation:

  • Open the InRule Configuration Utility (Start Menu -> Program Files -> InRule -> Configuration Utility)
  • If you are not prompted on the first screen to enter the license key - delete InRule.lic file from Program Files\InRule\InRuleSuite\LicenseFile directory and run the Configuration Utility again
  • Enter the new license key: The TDC serial xxxxxxxxxxxxxxxxxxxxxxxx
  • This will generate a new license key file (InRule.lic) which will extend the irAuthor trial period and can be copied to application directories if needed.
    \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\


.NET Class related questions

Use static functions in InRule

Public custom static functions available in your assembly can be used in InRule.
Using static functions via irAuthor:
Right click on Endpoints
Click on "Insert .NET Function Library"
Load your assembly
All the public static methods will be available to be used in irAuthor.

Note:
If the static function contains custom types, prior to the above step, you need to load that assembly to the schema.

Use Instance Methods in InRule

Custom Instance methods available in your assembly can be used in InRule via irAuthor:
Right click on Schemas
Click on "Insert NETAssemblySchema"
Load your assembly
All the public methods will be available to be used in irAuthor.
Methods are not selected by default. You need to select them and click on "Apply to Ruleapp" to reflect the schema in irAuthor.

How to use custom objects in irSDK

Prerequisite: Schema(.NET Assembly containing custom object) has to be bound via irAuthor
InRule provides the flexibility to use custom object that has been bound to the schema via irAuthor.
Once the rules are created against this schema you can get all the return values into your custom object after applying the rules.


The link shows how to implement this:\ Samples\ObjectState.Invoice
Steps to follow: Open

\Samples\ObjectState.Invoice\ObjectAsStateInvoice\RuleApps\ObjectAsStateInvoice.ruleapp

Note: The schema has been loaded with "Invoice" object. And all the Invoice entities are pre-populated.
Open the .NET solution located :

\Samples\ObjectState.Invoice\ObjectAsStateInvoice
ObjectEntityState state = new ObjectEntityState("Invoice", _invoice);
_invoice is the object of the instance class Invoice.
_invoice will contain all the results after execution of the rules.

XML/XSD related questions

How do I bind my XSD data

XSD data can be bind to InRule via irAuthor:
Right click on Schemas
Click on "Insert XMLSchemaDefinition"
Load your XSD
All the elements and related types get autoselected.
Click on "Apply to Ruleapp" to reflect the schema in irAuthor.

How do I use xml namespaces within InRule

Refer to the above question

Webservice

Use InRule as a webservice

Inrule offers a general purpose web service called "RuleEngineService".
But for utmost flexibility to pass and return values we recommend you to write custom wrapper around RuleEngineService.
The sample showing the wrapper around RuleEngineService is located at:
Samples\CustomRuntimeWebservice

Web application

How to use InRule in a web application scenario

There is an example of a web version of a simple line-item invoice example included in the InRule install. This demonstrates how to persist RuleSessionState in an ASP.NET Session State. You can find it in the folder Samples\WebApp.InvoiceSimple

Note: The above sample also explains "How to use ASP.NET Session State to store RuleSessionState"

irVerify

How to disable entity field comments to show up in irVerify

Click on Tools in irVerify. Click on Options and click Entity Tab and uncheck "Show entity field comment".

Web Service Certificate Override

How to override the certificate path from code

InRule provides the flexibility of overriding the certificate path from your code. See sample code below

//...set up session etc...

//web service def
WebServiceDef wsOverride = new WebServiceDef(
        "ServiceName1", //service name
        "http://tempuri.org/ServiceOverride.asmx", //override service URL
        null //override WSDL URL
    );

//override a method by name:
WebServiceDef.OperationDef opOverride = new WebServiceDef.OperationDef("WebMethodName1");//
Specifies the case-sensitive name of a web method (exposed by the parent web service)

//override cert path
opOverride.X509Certificate =
@"C:\OverrideCert\Test.cer"; wsOverride.Operations.Add(opOverride);

session.EndPointOverrides.Add(wsOverride);

Note: This would help to use a central path from the server environment for
passing the certificate.

Serialize InRule Object to XML

How to serialize InRule object (for eg. RuleExecutionLog) to XML

InRule.Repository.Utilities.XmlSerializationUtility.ObjectToXML(object obj, bool useFormatting)
InRule.Repository.Utilities.XmlSerializationUtility.ObjectToXML(object obj)

Logging

How does InRule handle logging

  • By default, InRule attempts to write any warning or error level log messages to the "InRule" Event Log. Previously, when one or more "InRule.*" event log sources were not registered, this resulted in logging information not being recorded at all.
  • A FileLogger is now automatically setup for a given event log source name if that source name is not registered (e.g., "InRule.Repository", "InRule.Runtime"), to a log file found in %TEMP%\InRuleFileLoggerLogs\
  • The above means that logging will now occur for any application using irSDK, even when the InRule installer has not been run on the application host and / or an "inrule.logging" section is not present in its config file.
  • There are two recommended logging approaches for deployed irSDK apps:
  • Run the installer on the host machine, with "irSDK" as one of the selected features. This will register the InRule.* event log sources, allowing logging to the "InRule" event log.
  • Use file-based logging (via the automatically created FileLogger described above, or the explicitly created one described below).
    • A FileLogger may be explicitly setup using this syntax in the config file of the custom application:

<configSections>
<section name="inrule.logging" type="InRule.Repository.Logging.Configuration.LoggingSectionHandler,InRule.Repository"/>
</configSections>

<group typeName="InRule.Repository.Logging.Loggers.LoggerGroup, InRule.Repository" level="Warn">
<logger typeName="InRule.Repository.Logging.Loggers.EventLogLogger, InRule.Repository">
<option name="filename" value="%TEMP%\YourApp.log"/>
</logger>>
</group>

  • All InRule applications (irServer, irAuthor et al.) have an explicit  "inrule.logging"  section in their config files enabling Event logging.


Compiler Errors

How to look for compiler errors via SDK

Compiler errors can be obtained via RuleApplicationInfo object as shown below

catch (RuleCompileErrorsException ex)
{
bool foundAtLeastOneExpectedCode = false;
foreach (CompilerErrorInfo cei in ex.RuleApplicationInfo.CompilerErrors)
{
Debug.WriteLine(cei.ErrorCode + " " + cei.Message);
if (cei.ErrorCode == RuleEngineErrorCode.ValidateCompileError)
{
foundAtLeastOneExpectedCode = true;
}
}
Assert.IsTrue(foundAtLeastOneExpectedCode);
}

Threading

Can two threads simultaneously use the same RuleApplicationDef

Yes you can use but following precautions have to be taken to be thread safe.

You should either ensure you are working with a copy of RuleApplicationDef on each instance (make a copy using the XmlSerializer) or lock the RuleApplicationDef instance during the call.

Below is the code that shows how to copy

RuleApplicationDef  copy = (RuleApplicationDef) InRule.Repository.Utilities.XmlSerializationUtility.CopyObject(ruleappdef);

Access value list items via irSDK

How to access valuelist items via irSDK

//By valuelist name
DataManager dm = new DataManager(myRuleApplicationDef);
ListItemDefCollection lm =  dm.GetValueList("MyValueListName");

//lm.Count gives you the count of items in the list
foreach (ListItemDef listItemDef in lm)
{
   string s = listItemDef.Value; //value in the list
}

Catalog instance

How many instances of catalog does any installer install

Each installer run installs / upgrades exactly one catalog instance.

Catalog instance

Is there a way to install /upgrade all instances of catalog at once

Each installer run installs / upgrades exactly one catalog instance.

When you run the installer with no cmd-line args it will upgrade the msi-installed instance.

To upgrade the other catalog instances you have which were installed via "no-msi" install, you should run the no-msi installer for each.

You can automate this by calling setup.exe on each no-msi catalog-instance dir with the "no-msi" cmd-line arguments – see the "Install Instructions" doc, "Command Line Options" section for more on this.

Halt Ruleset

How can I halt the ruleset currently executing

Specifies either 'halt this rule set' to halt the currently executing rule set or 'halt all rule execution' to stop all rule sets being executed by the rule engine. In the latter case, the halt is indicated as a Runtime error having code "ExecutionHaltedByAuthoredRule". NOTE: this action is not supported within an optimized rule set.

Catalog

How do I remove rule applications from the Catalog

Any application having a label on at least one revision in its history may not currently be fully deleted – it may only be marked inactive.
To mark inactive, click on "Remove" and answer "No" to the remove-permanently dialog.

Catalog

How do I increase catalog service connection time

From irAuthor you can increase the catalog connection timeout under irAuthor -> Tools -> Options

 

Schemas via irSDK

How do I get all the schemas defined in a ruleapp

Code snippet that looks up all the schemas in the rule app:
foreach (EndpointInfo info in Session.RuleApplicationInfo.SchemaEndPoints)

{
                Debug.WriteLine(info.Name);
}

Query against Inline table

Are complex queries supported for inline table

Simple queries are supported on inline tables – functions like Sum() and join are supported only in queries against databases.

Rule Authoring

Question. How do I know which Ruleset fire mode and run mode I should use?

Answer: Auto-sequential (the default choice) is best for most purposes, as it automatically manages dependencies.

See also: Why would I use the "Single-Pass Sequential" run mode?

Rule Authoring

Question. Why are some actions unavailable for Optimized rulesets?

Answer: The nature of an optimized ruleset is such that certain actions are likely to trigger unwanted excessive or infinite loop (until terminated by cycle count) behavior, therefore only a limited set of actions is allowed.

Rule Authoring

Question. What does "activated by default" mean in the Ruleset definition screen?

Answer: Auto Rulesets may be in an "activated" or "deactivated" state. When activated, they are run as part of an Apply Rules directive, otherwise they are not. Activated by default means that an explicit "Activate Ruleset Action" is not required for the ruleset to be enabled to run.

Rule Authoring

Question: Why would I use the "Single-Pass Sequential" run mode?

Answer: "Single-Pass Sequential" is sometimes preferable over "

Question. Can I call an Auto Sequential ruleset using ExecuteRuleset?

Answer: No, only Explicit RuleSets may be invoked directly; activate / deactivate ruleset may be used with auto rulesets with a similar effect.

Question. When should I use a Calculation vs a Ruleset?

Answer: Calculations are most appropriate when there is benefit to referencing a given expression in multiple places or when you want to define a value in output state via a single expression, and when the rule expression is relatively simple.

RuleSets allow for setting one or more state values, invoking actions and easier management of complex expression logic.

Question. When should I use a Decision Table?

Answer: A decision table is a very powerful and simple way to capture multiple logic conditions and associated actions in a grid format. It provides consistency checking which may be used to verify that all logic combinations are accounted for.

Question. When should I use a Language Rule vs a Syntax Rule?

Answer: Language rules are most appropriate for users preferring point and click entry, syntax rules for users preferring keyboard entry (though language rules can also largely be entered via keyboard alone using hotkeys).

Syntax rules are sometimes also required for expressions having complex forms of order-of-evaluation parenthesization.

Question. When should I check the "cascade parent context" checkbox?

Answer: This is useful when it is desired to address a parent context in a rule expression from within some child entity or collection member, when a parent reference is not already available in the bound schema.

Question. When should I use a Classification?

Answer: Classifications allow for powerful "is" abstractions to be expressed in rules, such as "LoanAmt is High" or "Animal is Dog"

Question. When should I use Notifications?

Answer: Notifications are used for two primary purposes:

  • Indicating some condition such as "Customer qualifies for invoice discount"
  • As an execution trace

Question. Why do I sometimes see a "Submit" button in irVerify, but not always?

Answer: When irAuthor: Tools -> Options -> irVerify: "Automatically Apply rules on tester startup for entities" is checked, this button does not appear, otherwise it does.

Question. How do I use a variable with a business language rule?

Answer: Variables are declared via the "Declare Variable" action under a ruleset. Any language rule below the declaration my reference the variable as it would a field.

Question. How do I refer to individual collection members in a "do while" loop?

Answer: Set up a loop counter and address the members by index – note the index is 1-based (starts with 1).

 

 


Home | Contact Us | Site Map | Legal | Privacy | Copyright 2008 InRule Technology Inc. All rights reserved.