GetDataSet Method (.NET)

The GetDataSet method returns a .NET DataSet object that contains a DataTable.  The DataTable contains the results for each of the rules in the RET rule set that was checked.  Using the DataSet and DataTable in this fashion is useful if you wish to enumerates the results of the RET tests, or if you want to assign the results to any object which accepts a .NET DataSet as a source that can be bound to.

 

Syntax:

ds = ruleEngine.GetDataSet(BrowserObj bhObj, ExtendedBrowserObj extBrowObj);

bhObj: The BrowserInfo instance for the current request

extBrowObj The ExtendedBrowserObj instance for the current request

 

Returns:

ds: A .NET DataSet object representing the results of the rules test.

 

C# Example:

<%

RuleEngine engine = RuleEngine.GetFromFile("rules.xml"));

ExtendedOptions options = engine.GetExtendedOptions();

ExtendedBrowserObj extendedBrowObj = BrowserObj.GetExtendedBrowser(options);

BrowserObj browObj = BrowserObj.GetBrowser();

DataSet ResultsAsDataSet = engine.GetDataSet(browObj, extendedBrowObj);

 

// Here's how to dynamically enumerate the results

DataTable dataTable = ResultsAsDataSet.Tables[0];

foreach (DataRow dataRow in dataTable.Rows)

{

   string ruleID = (string)dataRow["id"];

   string ruleStatus = (string)dataRow["answer"];

   string ruleName = (string)dataRow["name"];

   string ruleMsg = (string)dataRow["message"];

}

 

// Here's how to bind the results to a .NET object which takes a DataSet as a source:

GridView1.DataSource = ResultsAsDataSet ;

GridView1.DataBind();

%>

 

Tip: Use the GetHtmlResults method to have BrowserHawk automatically generate a full HTML table that represents the pass/fail results to be shown to the user, with full CSS markup.  If you need fine grain control over the creation of the HTML table, you can use the approach displayed above to dynamically enumerate the results and build your own HTML table.

 

Tip: See the rules-dataset.aspx sample distributed with BrowserHawk for a  working example that  demonstrates using BrowserHawk to enumerate RET results and programmatically access the results.

 

Note: This method requires the Enterprise Edition of BrowserHawk.

 

See Also:

RuleEngine GetExtendedOptions Method (.NET)

GetFromFile Method (.NET)

GetFromString Method (.NET)

GetLogOptions Method (.NET)

GetResult Method (.NET)

About the RuleEngine Class

About Rule Enforcement Technology (RET)