ReportingService中matrix设置alternating colors

The RowNumber function in the Matrix is totally different with it in the table. So if we want to have the alternative color in the matrix, we may use the Running Function.

in the table,you can set the backgroundcolor property  as =iif(RowNumber(Nothing) Mod 2,"gray","white").

 

in the matrix,you can follow this:

Green-Bar Matrix

Question:
How can I get a green-bar effect (alternating colors) in a matrix?

Answer:
For a green-bar table, you can simply use a background color expression like this: =iif(RowNumber(Nothing) Mod 2,"Green","White")
However, there is currently no GroupNumber() function on which to base a green-bar calculation in a matrix.
GroupNumber can be (mostly) simulated by using the RunningValue function to get a running distinct count of group expression values.
However, the trickiest part of green-bar in a matrix is the fact that some matrix cells may contain no data at all.  This makes the group number calculation incorrect for empty cells.
To work around this, you need to effectively calculate the group number in the row header and then use that value inside the data cells.

Step 1:  Add a (fake) inner row grouping
Select the innermost row grouping in your matrix.  Right-click and select Insert Group.
For the group expression, group on a constant, such as =1

Step 2:  Calculate the name of the color in the inner row grouping header
In the Value property of the newly created grouping header, add a calculation for the desired color based on a running value of a count distinct of the containing group expression.
For example: =iif(RunningValue(Fields!Country.Value,CountDistinct,Nothing) Mod 2, "AliceBlue", "White")
Note:  If you have more than one row grouping, you may need to do the count distinct on the combination of all group expressions, like this:
=iif(RunningValue(Fields!Country.Value & CStr(Fields!Year.Value),CountDistinct,Nothing) Mod 2, "AliceBlue", "White")

Step 3:  Set the background color of the inner row grouping header to =Value

Step 4:  Set the background color of the matrix data cell to the value of the inner row grouping header
For example:  =ReportItems!ColorNameTextbox.Value

Step 5:  Set the background color of the outer row grouping header
You'll need to use the same expression here that you used for the Value of the inner row grouping header.

Step 6:  "Cloak" the inner row grouping header (so it looks like part of of the outer grouping header)
Set the right border style of the outer grouping header to None.
Set the left border style of the inner grouping header to None.
Set the font weight of the inner grouping header to 1 pt.
Set the font color of the inner grouping header to =Value.
Set the CanGrow property of the inner grouping header to False.
Drag the inner grouping header to be as narrow as possible.
Optional:  Hand-edit the RDL to set the width of the inner grouping header to 0in.

A full working sample of green-bar matrix is attached.

 

Published Monday, August 30, 2004 6:22 PM by ChrisHays
Filed under: ,

Attachment(s): MatrixGreenBar.rdl
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
可以使用PySimpleGUI的Checkbox元素来实现table的复选框。具体实现方法如下: 1. 首先,需要定义一个包含复选框的列。可以使用Table元素的column_headers参数来定义列标题,使用Column元素的checkbox参数来定义包含复选框的列。 例如,下面的代码定义了一个包含复选框的列: ``` import PySimpleGUI as sg data = [['John', 'Doe', True], ['Jane', 'Doe', False], ['Bob', 'Smith', True]] layout = [[sg.Table(values=data, headings=['First Name', 'Last Name', 'Select'], column_widths=[10, 10, 10], auto_size_columns=False, num_rows=10, enable_events=True, key='-TABLE-', column_order=[0, 1, 2], select_mode=sg.TABLE_SELECT_MODE_EXTENDED, row_height=25, justification='left', alternating_row_color='lightblue', )]] window = sg.Window('Table with Checkbox', layout) while True: event, values = window.read() if event == sg.WINDOW_CLOSED: break print(event, values) window.close() ``` 2. 然后,在Table元素的values参数,需要将每行数据的最后一列设置为True或False,以表示复选框的选状态。 例如,上面的代码,data列表的第一行数据,最后一列的值为True,表示该行的复选框被选。 3. 最后,在事件循环,可以使用window.read()方法获取用户的操作,例如选或取消选某个复选框。 例如,上面的代码,当用户选或取消选某个复选框时,会输出相应的事件和值。 希望这个回答能够帮助你解决问题!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值