使用下拉菜单的Spotfire数据限制

时间:2018-08-30 14:39:49

标签: expression spotfire tibco

我有一个Spotfire仪表板,其中包含两个下拉列表,一个用于Day,一个用于Month,用于限制可视化数据。

enter image description here

我需要能够同时使用两个过滤器。目前,我已经写出了一个case语句来执行此操作,但是默认情况下,case语句在达到真值时会停止对表达式进行求值。
例如,在下面的示例中,我将MonthSelector的语句放在顶部,它不会继续对DaySelector进行评估。

case

when "${MonthSelector}"="all" then [Month] <> ''

when "${MonthSelector}"<>"all" then [Month] = "${MonthSelector}"

when "${DaySelector}"="all" then [Week_Day] <> ''

when "${DaySelector}"="WeekDay" then [Week_Day] <> 'Saturday' and [Week_Day] <> 'Sunday'

when "${DaySelector}"="WeekEnd" then [Week_Day] = 'Saturday' OR [Week_Day] = 'Sunday'

when "${DaySelector}"<>"WeekEnd" AND "${DaySelector}"<>"WeekDay" AND "${DaySelector}"<>"all" then [Week_Day] = "${DaySelector}"
else false end case

我需要帮助,要么以某种方式使Spotfire继续评估超过第一个true的case语句,要么以另一种方式编写数据限制表达式以基于两个下拉列表限制数据。

我很茫然,任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:1)

您可以尝试嵌套案例吗?也许像这样未经测试的表达式:

case
    when "${MonthSelector}"="all" then case
        when "${DaySelector}"="all" then [Week_Day] <> '' and [Month] <> ''
        when "${DaySelector}"="WeekDay" then [Week_Day] <> 'Saturday' and [Week_Day] <> 'Sunday' and [Month] <> ''
        when "${DaySelector}"="WeekEnd" then [Week_Day] = 'Saturday' OR [Week_Day] = 'Sunday' and [Month] <> ''
        when "${DaySelector}"<>"WeekEnd" AND "${DaySelector}"<>"WeekDay" AND "${DaySelector}"<>"all" then [Week_Day] = "${DaySelector}" and [Month] <> ''
        else false
        end
    when "${MonthSelector}"<>"all" then case
        when "${DaySelector}"="all" then [Week_Day] <> '' and [Month] = "${MonthSelector}"
        when "${DaySelector}"="WeekDay" then [Week_Day] <> 'Saturday' and [Week_Day] <> 'Sunday' and [Month] = "${MonthSelector}"
        when "${DaySelector}"="WeekEnd" then [Week_Day] = 'Saturday' OR [Week_Day] = 'Sunday' and [Month] = "${MonthSelector}"
        when "${DaySelector}"<>"WeekEnd" AND "${DaySelector}"<>"WeekDay" AND "${DaySelector}"<>"all" then [Week_Day] = "${DaySelector}" and [Month] = "${MonthSelector}"
        else false
        end
    else false
end