SSRS条件边界报告

时间:2014-03-10 10:07:02

标签: reporting-services ssrs-2008 ssrs-tablix

我的报告为table组件。我想应用以下逻辑:

如果值INCID不为空,则边框应为“Solid”(表示它应具有边框),
如果值INCID为null,则边框应为“None”(表示该表应没有边框)。

我使用=IIf(IsNothing(Fields!INCID.Value) = 1,"Solid","None")但它不起作用。哪里可能是问题?如果我应用此设置并保存此设置然后返回表达式,则不会保存。

3 个答案:

答案 0 :(得分:1)

迟了3年,但我的答案有所不同,也许有一天会帮助其他人。

我能够通过将表达式输入BorderStyle属性来使表达式工作。

点击给定的单元格>打开属性>展开BorderStyle>选择所需的细胞侧>输入iif表达式。

例如以下内容对我有用:

declare @tablename nvarchar(255) = 'schema.tablename'

declare @results table (ColumnName nvarchar(255))

/* Declare the Variables to be used in the cusor*/
declare @column_name nvarchar(255)


/* Declare the cursor and the value set that will be used*/
declare tbl_Crawler cursor
    for SELECT name FROM sys.columns 
        WHERE object_id = OBJECT_ID(@tablename)

/* Make the Cursor Available*/
open tbl_Crawler

/*Load the first row into the variables (must match sequence in cursor select)*/
fetch next from tbl_Crawler
    into @column_name

/*Creates While loop that will run until the curor is empty*/
while @@fetch_status = 0
    begin

/*statement to be run every loop of the cursor*/

    DECLARE @sqlCommand nvarchar(1000)

    declare @counts int

    SET @sqlCommand = 'SELECT @cnt=COUNT(*) FROM '+@tablename+' WHERE '+ @column_name + '  is null'
    EXECUTE sp_executesql @sqlCommand, N'@cnt int OUTPUT',  @cnt=@counts OUTPUT


    if (isnull(@counts,0) > 0)
        insert into @results 
        select @column_name

/*Loads the next row of records into the variables (must match sequence in cursor select)*/
    fetch next from tbl_Crawler
        into @column_name
    end
/*Release the cursor so that it is not retained in memory*/
close tbl_Crawler
deallocate tbl_Crawler

/* if in function return @results*/
    select * from @results

答案 1 :(得分:0)

好的, this 似乎是个问题。

答案 2 :(得分:0)