Avatar of nsehmi
nsehmiFlag for United States of America

asked on 

Group Invincibility Depending on Duplicate Name Entry in Reporting Services

There is a report that shows all the names and their hours during the week. I want to write a script or create a group where if there is a Duplicate name, it adds our the hours together and shows it on a different row..

For Eg

Now

123 John Doe    50 hours
123 John Doe    30 Hours
111 James         10 Hours
113 Doc             40 Hours

Should Show:
111 James         10 Hours
123 John Doe    50 hours
123 John Doe    30 Hours
Total: John Doe 80 Hours
113 Doc             40 Hours

Only when there is more than one entry, i want the group to be VISIBLE. Please let me know how i can accomplish this!
Microsoft SQL ServerDB Reporting Tools

Avatar of undefined
Last Comment
Chris McGuigan
Avatar of Chris McGuigan
Chris McGuigan
Flag of Canada image

By "Invincibility", I assume you meant "Invisibility"? But it sounded good anyway :-)

I would have to say this is a lot easier to achieve by adding a flag to the query to indicate whether there needs to be a group total or not.

So something like this;

    Select Id, Name, Hours, GroupTrigger = (Select Count(*) From MyTable As MT2 Where MT1.Id= MT2.Id)
        From MyTable As MT1


There are other SQLL approaches that may be better depending on your query but it's the way to go.
In your Group rows "Visibilty|Hidden" property you would put a formula like;
    =(Fields!GroupTrigger.Value = 1)

It will return true if only one record exists for that Name (well Id really) which will hide the Total.

Avatar of nsehmi
nsehmi
Flag of United States of America image

ASKER

The report is driven by a very complex stored procedure that has a lot of unions depending on selection type. Is it possible if you would know a VBscript that can handle this? Thanks

I will try what you suggested but a VBSCRIPT would be a lot easier to tackle with
You could try this;
In the "Visible|Hidden" property of the group row use this expression,
    =(RowNumber("table1_Group1")=1)

table1_Group1 is the default name for the first group in a table, change it to whatever your group is called.
This should hide the group if there is only 1 row in it.

Avatar of nsehmi
nsehmi
Flag of United States of America image

ASKER

Hey Chris,

This is exactly what i want. There is only one issue.. It doesnt show anything. when there is one row.
For Eg,

I want it to show all the rows in the report. However, when there is 2 rows with the exact name, i want the group to appear and show the calculation for both the rows.

Let me know if that is attainable. I think it needs a bit more tweak and we will be there!

THANK YOU!!!!
I'm assuming the total is in a "Group Footer"?
I'm also assuming you want to hide that group footer when it only contains one detail row?

If this is the case and you do what I said against the Group Footer row, you should achieve what you're after.
Also, the group name is case sensitive, make sure you have that typed correctly.
Avatar of nsehmi
nsehmi
Flag of United States of America image

ASKER

Well this is the case..

The group that i want to hide doesnt have a group header. Instead the information ( Name and Info) is in the Details Row of the table. The group footer displays the Total which i want to hide.

I tried putting the info in details in the group header.. but it was a reverse effect. It showed only the ones with one row and not with the 2 rows.

I changed it back.. but currently it shows 82 pages.. wierd.. the ones with one row doesnt even show the row.. just blank but only the table header and footer. when you go on the next pages, it just shows the ones with 2 rows and total which is totally correct

Thanks Chris
ASKER CERTIFIED SOLUTION
Avatar of Chris McGuigan
Chris McGuigan
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
It's just occurred to me that you may be putting the expression in the Grouping and Sorting Properties from "Edit Group".
This is not the right place, you are trying to hide just the group footer ROW, so this must be done at row-level.

If you do it in the group properties you will hide the whole group.
Microsoft SQL Server
Microsoft SQL Server

Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.

171K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo