How do I best display CheckBoxes in SQL Server Reporting Services?

前端 未结 8 552
北荒
北荒 2021-02-01 15:37

One of the many quirks of Reporting Services we\'ve run across is the complete and utter lack of a CheckBox control or even something remotely similar.

We have a form th

8条回答
  •  执笔经年
    2021-02-01 16:10

    Besides the different methods already presented, as of SQL Server 2008 R2 there's a built-in control that can be used for checkbox-alike functionality: the Indicator!

    Have a look here for details on how to use it: http://blog.hoegaerden.be/2012/08/04/displaying-checkboxes-in-an-ssrs-report/

    To be able to use a field of type bit, you'll have to cast it to int first. This can be done either in the dataset query or by adding a calculated field to the dataset.

    If you want the NULLs to come up as yellow, then you'll need to build the expression that way so it takes that requirement into account as well.

    Here's a possible expression for a calculated field:

    =Switch(
        IsNothing(Fields!YourBoolean.Value), 50,
        Fields!YourBoolean.Value = False, 0,
        Fields!YourBoolean.Value = True, 100)
    

    Depending on the meaning of your fields - is False good or bad - you may need to swap the zero and 100.

提交回复
热议问题