反转矩阵控件中嵌套列组的标题行

发布于 2024-09-27 02:50:42 字数 267 浏览 0 评论 0原文

在矩阵控件中,我按“大小”对列进行分组,然后按“颜色”对列进行分组。生成的表格如下所示:

default grouping

我需要反转标题行,因此表格如下所示:

grouping

子组中的值应显示在父组中相应值的上方

In a matrix control, I group columns by 'Size', and then by 'Color'. The resulting table looks like this:

default grouping

I need to invert the header rows, so the table looks like this:

grouping

The values from the child group should display above the corresponding value from the parent group.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

安人多梦 2024-10-04 02:50:42

也许可以通过将“父组”设置为“大小”和“颜色”的组合分组,但仅显示颜色,然后按子组/子组的“大小”进行分组。

更新:

好的,所以我创建了一个小数据集,我不确定该数据集是否与您返回的数据集相同,但也许它可以激发一些关于如何在 SQL 中操作数据以帮助获得您想要的内容的其他想法报告。

首先,我刚刚创建了一堆 SELECT ... UNION ALL 语句,但经过一番尝试后,我仍然无法获得接近所需视觉输出/分组的任何内容。所以这就是我使用的:

with CTE (Color, Size, CSGroup, Amt) As (
select 'Red' As color, 'Small' as size, 'RedSmall' as CSGroup, 1 as Amt union all
select 'Red' As color, 'Small' as size, 'RedSmall' as CSGroup, 1 as Amt union all
select 'Red' As color, 'Medium' as size,'RedMedium' as CSGroup, 1 as Amt union all
select 'Red' As color, 'Medium' as size, 'RedMedium' as CSGroup, 1 as Amt union all
select 'Red' As color, 'Medium' as size, 'RedMedium' as CSGroup, 1 as Amt union all
select 'Red' As color, 'Small' as size, 'RedSmall' as CSGroup, 1 as Amt union all

select 'Yellow' As color, 'Small' as size, 'YellowSmall' as CSGroup ,1 as Amt union all
select 'Yellow' As color, 'Small' as size, 'YellowSmall' as CSGroup ,1 as Amt union all
select 'Yellow' As color, 'Large' as size, 'YellowLarge' as CSGroup ,1 as Amt union all
select 'Yellow' As color, 'Large' as size, 'YellowLarge' as CSGroup ,1 as Amt union all
select 'Yellow' As color, 'Large' as size, 'YellowLarge' as CSGroup ,1 as Amt union all
select 'Yellow' As color, 'Medium' as size, 'YellowMedium' as CSGroup ,1 as Amt union all
select 'Yellow' As color, 'Medium' as size, 'YellowMedium' as CSGroup ,1 as Amt union all

select 'Blue' As color, 'Medium' as size, 'BlueMedium' as CSGroup, 1 as Amt union all
select 'Blue' As color, 'Medium' as size, 'BlueMedium' as CSGroup, 1 as Amt union all
select 'Blue' As color, 'Medium' as size, 'BlueMedium' as CSGroup, 1 as Amt union all
select 'Blue' As color, 'Small' as size, 'BlueSmall' as CSGroup, 1 as Amt union all
select 'Blue' As color, 'Large' as size, 'BlueLarge' as CSGroup, 1 as Amt union all
select 'Blue' As color, 'Large' as size, 'BlueLarge' as CSGroup, 1 as Amt union all

select 'Green' As color, 'Medium' as size, 'GreenMedium' as CSGroup, 1 as Amt union all
select 'Green' As color, 'Medium' as size, 'GreenMedium' as CSGroup, 1 as Amt union all
select 'Green' As color, 'Large' as size, 'GreenLarge' as CSGroup, 1 as Amt union all
select 'Green' As color, 'Large' as size, 'GreenLarge' as CSGroup, 1 as Amt union all
select 'Green' As color, 'Large' as size, 'GreenLarge' as CSGroup, 1 as Amt union all
select 'Green' As color, 'Small' as size, 'GreenSmall' as CSGroup, 1 as Amt union all
select 'Green' As color, 'Small' as size, 'GreenSmall' as CSGroup, 1 as Amt)
Select Color, Size, SUM(Amt) As Amount From CTE group by Color, Size

你可以忽略CSGroup我最终没有使用它。

因此,它给了我你的“外观”需要在数据集中。

我制定了一个矩阵并按大小和分组进行分组。 Color (=Fields!size.Value & Fields!color.Value)

I 然后插入一个组,并按 Size (=Fields!size.Value) 进行

分组“顶部”列分组我有 =Fields!color.Value

在第二列分组中我有 =First(Fields!Size.Value)

在数据文本框中我有 < code>=Sum(Fields!Amount.Value)

然后,右键单击第二个列分组并选中“隐藏重复项”框。然后我在下拉列表中选择了Dataset1

我唯一无法做的就是使大小居中,因为我无法合并文本框。

分组示例

Maybe by making the Parent group a combined grouping of both Size and Color, however only display Colors, then Group on Size for the Child/Subgroup.

Update:

Ok, so I created a small dataset, I'm not sure the dataset is anything like you are getting back, but maybe it can spur some other ideas on how you can manipulate the data in SQL to help get what you want in the report.

First I just created a bunch of SELECT ... UNION ALL statements, but after some toying, I still couldn't get anything close to the required visual output/grouping. So here is what I used:

with CTE (Color, Size, CSGroup, Amt) As (
select 'Red' As color, 'Small' as size, 'RedSmall' as CSGroup, 1 as Amt union all
select 'Red' As color, 'Small' as size, 'RedSmall' as CSGroup, 1 as Amt union all
select 'Red' As color, 'Medium' as size,'RedMedium' as CSGroup, 1 as Amt union all
select 'Red' As color, 'Medium' as size, 'RedMedium' as CSGroup, 1 as Amt union all
select 'Red' As color, 'Medium' as size, 'RedMedium' as CSGroup, 1 as Amt union all
select 'Red' As color, 'Small' as size, 'RedSmall' as CSGroup, 1 as Amt union all

select 'Yellow' As color, 'Small' as size, 'YellowSmall' as CSGroup ,1 as Amt union all
select 'Yellow' As color, 'Small' as size, 'YellowSmall' as CSGroup ,1 as Amt union all
select 'Yellow' As color, 'Large' as size, 'YellowLarge' as CSGroup ,1 as Amt union all
select 'Yellow' As color, 'Large' as size, 'YellowLarge' as CSGroup ,1 as Amt union all
select 'Yellow' As color, 'Large' as size, 'YellowLarge' as CSGroup ,1 as Amt union all
select 'Yellow' As color, 'Medium' as size, 'YellowMedium' as CSGroup ,1 as Amt union all
select 'Yellow' As color, 'Medium' as size, 'YellowMedium' as CSGroup ,1 as Amt union all

select 'Blue' As color, 'Medium' as size, 'BlueMedium' as CSGroup, 1 as Amt union all
select 'Blue' As color, 'Medium' as size, 'BlueMedium' as CSGroup, 1 as Amt union all
select 'Blue' As color, 'Medium' as size, 'BlueMedium' as CSGroup, 1 as Amt union all
select 'Blue' As color, 'Small' as size, 'BlueSmall' as CSGroup, 1 as Amt union all
select 'Blue' As color, 'Large' as size, 'BlueLarge' as CSGroup, 1 as Amt union all
select 'Blue' As color, 'Large' as size, 'BlueLarge' as CSGroup, 1 as Amt union all

select 'Green' As color, 'Medium' as size, 'GreenMedium' as CSGroup, 1 as Amt union all
select 'Green' As color, 'Medium' as size, 'GreenMedium' as CSGroup, 1 as Amt union all
select 'Green' As color, 'Large' as size, 'GreenLarge' as CSGroup, 1 as Amt union all
select 'Green' As color, 'Large' as size, 'GreenLarge' as CSGroup, 1 as Amt union all
select 'Green' As color, 'Large' as size, 'GreenLarge' as CSGroup, 1 as Amt union all
select 'Green' As color, 'Small' as size, 'GreenSmall' as CSGroup, 1 as Amt union all
select 'Green' As color, 'Small' as size, 'GreenSmall' as CSGroup, 1 as Amt)
Select Color, Size, SUM(Amt) As Amount From CTE group by Color, Size

You can ignore the CSGroup I didn't end up using it.

So with that, it about gave me the "look" of what you need in the Dataset.

I drug out a Matrix and grouped on Size & Color (=Fields!size.Value & Fields!color.Value)

I Then inserted a group, and grouped on Size (=Fields!size.Value)

In the "top" column grouping I have =Fields!color.Value

In the second column grouping I have =First(Fields!Size.Value)

In the Data textbox I have =Sum(Fields!Amount.Value)

Then, Right-Click on the second Column Grouping and Check the Box "Hide Duplicates". I then selected Dataset1 in the drop down.

The only thing I was Unable to do was get the Size centered since I was unable to Merge the textboxes.

Grouping Example

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文