if jsonParam['includeEmpty'] != None:
    filter.IncludeEmpty = jsonParam['includeEmpty']

dataType = dataTable.Columns[jsonParam['column']].RowValues.DataType

if jsonParam['value']['min'] != None or jsonParam['value']['max'] != None:
    valMin = getCastValue(jsonParam['value']['min'], dataType)
    valMax = getCastValue(jsonParam['value']['max'], dataType)
    if valMin > valMax:
        if jsonParam['dataTable'] != None:
            notify.AddErrorNotification("Error applying a Range Filter on the data table " + jsonParam['dataTable'] +
                ", column " + jsonParam['column'] + ".", "The minimum value provided for the Value Range is greater than the maximum value.", "")
        else:
            notify.AddErrorNotification("Error applying a Range Filter on the active data table, column " + jsonParam['column'] + ".",
                "The minimum value provided for the Value Range is greater than the maximum value.", "")
    else:
        filter.ValueRange = ValueRange(valMin, valMax)

if jsonParam['valueDataRange']['min'] != None or jsonParam['valueDataRange']['max'] != None:
    valMin = getCastValue(jsonParam['valueDataRange']['min'], dataType)
    valMax = getCastValue(jsonParam['valueDataRange']['max'], dataType)
    if valMin > valMax:
        if jsonParam['dataTable'] != None:
            notify.AddErrorNotification("Error applying a Range Filter on the data table " + jsonParam['dataTable'] +
                ", column " + jsonParam['column'] + ".", "The minimum value provided for the Value Data Range is greater than the maximum value.", "")
        else:
            notify.AddErrorNotification("Error applying a Range Filter on the active data table, column " + jsonParam['column'] + ".",
                "The minimum value provided for the Value Data Range is greater than the maximum value.", "")
    else:
        filter.ValueDataRange = ValueRange(valMin, valMax)

try:
    if jsonParam['visualScale'] != None:
        filter.VisualScale = Enum.Parse(clr.GetClrType(VisualScale), jsonParam['visualScale'])
except ArgumentOutOfRangeException, ex:
    if jsonParam['dataTable'] != None:
        notify.AddErrorNotification("Error applying a Range Filter on the data table " + jsonParam['dataTable'] +
            ", column " + jsonParam['column'], ex.ToString(), "")
    else:
        notify.AddErrorNotification("Error applying a Range Filter on the active data table, column " + jsonParam['column'], ex.ToString(), "")
