When you select Use Rule Settings from the Configuration Option ring control on the Advanced tab of the Edit Rules dialog box to use rule settings during analysis, the analysis module uses the AnalysisContext.GetRuleConfiguration method to retrieve the rule configuration and then uses the RuleConfiguration.RuleSettingValues property to access the setting values. Use the RuleSettingValues.GetBooleanValue, RuleSettingValues.GetStringValue and RuleSettingValues.GetNumberValue methods to obtain individual setting values.

The following examples show how to access a number rule setting value in LabVIEW, LabWindows/CVI, Microsoft Visual C#, and Microsoft Visual C++.

LabVIEW

LabWindows/CVI

TSAnalyzerObj_RuleConfiguration ruleConfiguration = 0; TSAnalyzerObj_RuleSettingValues ruleSettingValues = 0; double mySettingValue = 0.0; tsErrChk(TSAnalyzer_AnalysisContextGetRuleConfiguration (analysisContext, &errorInfo, "MyCompany_RuleId", &ruleConfiguration)); tsErrChk(TSAnalyzer_RuleConfigurationGetRuleSettingValues(ruleConfiguration, &errorInfo, &ruleSettingValues)); tsErrChk(TSAnalyzer_RuleSettingValuesGetNumberValue(ruleSettingValues, &errorInfo, "MySetting", &mySettingValue));

Error:

CLEAR(ruleConfiguration, CA_DiscardObjHandle); CLEAR(ruleSettingValues, CA_DiscardObjHandle);

Microsoft Visual C#

RuleConfiguration ruleConfiguration = analysisContext.GetRuleConfiguration("MyCompany_RuleId"); double mySettingValue = ruleConfiguration.RuleSettingValues.GetNumberValue("MySetting");

Microsoft Visual C++

TSAnalyzer::RuleConfigurationPtr ruleConfiguration = analysisContext->GetRuleConfiguration("MyCompany_RuleId"); double mySettingValue = ruleConfiguration->RuleSettingValues->GetNumberValue("MySetting");