found, datavizRules = dataviz.TryGetFilterRules()
conditionValue = createConditionalValue(jsonParam['threshold']['type'],jsonParam['threshold']['value'])
comparisonOperator = Enum.Parse(clr.GetClrType(RuleComparisonOperator),jsonParam['comparisonOperator'])
filterRule = None
if(found):
    for testedRule in datavizRules:
        ruleType = clr.GetClrType(type(testedRule.RuleCondition)).ToString()
        if(testedRule.DisplayName == jsonParam['displayName'] and ruleType == 'Spotfire.Dxp.Application.Visuals.ThresholdRuleCondition'):
            filterRule = testedRule
            break
    if(filterRule == None):
        filterRule = datavizRules.AddThresholdRule(jsonParam['expression'],comparisonOperator, conditionValue, jsonParam['hideMatchedItems'])
        filterRule.ManualDisplayName = jsonParam['displayName']
    filterRule.Enabled = jsonParam['enabled']
    filterRule.EvaluatePerTrellis = jsonParam['evaluatePerTrellis']
    filterRule.Expression = jsonParam['expression']
    filterRule.RuleCondition.Threshold = conditionValue
    filterRule.RuleCondition.ComparisonOperator = comparisonOperator

