我可以使用 returns SSRS 报告代码中的字符串列表作为 tablix 中的 headers 的方法吗?

Can I use a method that returns a list of strings in SSRS report code as the headers in a tablix?

我有 table 一天中每半小时需要包含 50 列(+2 用于夏令时)。所以每列将是 HH1、HH2、HH3...HH50。

我在报表属性代码部分写了这段代码

Function GetHH() As List(Of String)
    Dim headers As List(Of String) = new List(Of String)
    For index As Integer = 1 to 50
        headers.Add("HH" & index)   
    Next    
    return headers
End Function

有没有办法将此函数的输出用作我的 tablix 的 headers?或者我需要将 headers 添加到数据库中的某种数据集并从那里添加它吗?

列组功能非常适合于此。正如您提到的,您需要将 SQL 语句写入数据集中的 return 这些值。然后您可以将您的列组设置为对这些值进行分组。这样,您的 table 总能得到正确的列数,您不必手动添加它们。