Overriding DataElements at Runtime

  • Updated

Prerequisites:  A valid RuleSession
Namespaces: InRule.Runtime, InRule.Repository
Classes:   RuleSession, TableDef, XmlDocumentDef
See Also: Retrieving a Rule Application, Creating a RuleSession

Overriding an inline table

ValueList newValueList = ValueList.New(
 "Mon", "Monday",
 "Tue", "Tuesday",
 "Wed", "Wednesday",
 "Thu", "Thursday",
 "Fri", "Friday",
 "Sat", "Saturday",
 "Sun", "Sunday");
ruleSession.Overrides.OverrideInlineValueList("InlineValueList1", newValueList);

Overriding an inline XML document

using (var reader = new StringReader("<invoice><lineitem><id>1</id><name>Pencil</name>
price>$1.00</price></lineitem><lineitem><id>2</id><name>Computer</name>
price>$1000.00</price></lineitem></invoice>"
))
{
 XPathDocument xml = new XPathDocument(reader);

 // Override the inline XML document
 ruleSession.Overrides.OverrideXmlDocument("InlineXMLDocName", xml);
}

Overriding an SQL query

ruleSession.Overrides.OverrideQuery("SQLQuery1", "select Name from Customer where id = 2");

Was this article helpful?

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.