SSRS hiding a row group if there are no detail rows - reporting-services

Can someone please help me write a custom code that will check if the details of the row group = nothing? I'd like to use this as a show/hide expression such that table 0 will not display if there are no records within the group.
I can't seem to use aggregations for the row group details at the row group level.
Edit:
example 1 with a detail row
example 2 with without a detail row but the group header still displays. I'd like to hide this group completely:

OK, so it looks like you want to hide a table, not just a group within a table.
If this is not correct , please post your full report design.
You should be able to just count the rows in the dataset that the table is bound to.
So if your table is bound to `DataSet`` the 'Hidden' property would just be
=COUNTROWS("DataSet1") = 0
"DataSet1" is the name of the dataset, it is case sensitive and must be enclosed in double quotes.
The table will be hidden but the space it consumes will not be used, in other words, you will have a blank space where the table should be.
Alternatively, you can set the NoRowsMessage property to simple text message or an expression which will be displayed instead of just hiding the table.

I ended up using an IIF(IsNothing(Fields!MyField.Value), Parameters!ShowMissingGroup.Value,False) for the row group expression visibility then using a parameter to hide/show it.

Related

SSRS report tables mutiple lines not showing

I am doing Microsoft Dynmics D365 report layout. I have a table in my report that need to show the lines from the table in MS Dynamic D365. Which have only 2 lines.
D365 frontend system:
In the report layout, it is only showing the first line and the second line is not showing.
Report layout first line only showing:
I want the 2 lines to be showed in the report. I am not sure if my coding is not right or the row group that I am grouping in the report design. Please help me please. Apperciated.
here is my code in the dp class to get the table lines:
PurchPurchaseOrderTmp.MGAItemLabelName = PurchExtendedMaster.ExtName;
PurchPurchaseOrderTmp.MGAColValue1 = PurchExtended.ColValue1;
PurchPurchaseOrderTmp.MGAColValue2 = PurchExtended.ColValue2;
PurchPurchaseOrderTmp.MGAColValue3 = PurchExtended.ColValue3;
PurchPurchaseOrderTmp.MGAColValue4 = PurchExtended.ColValue4;
PurchPurchaseOrderTmp.MGALabelId = PurchExtended.LabelId;
//PurchPurchaseOrderTmp.MGALabelIdString += int2Str(PurchExtended.LabelVersion);
if (PurchPurchaseOrderTmp.MGAItemLabelName != "") {
PurchPurchaseOrderTmp.MGALabelIdString = strFmt("%1-%2",
PurchExtended.LabelId, int2Str(PurchExtended.LabelVersion));
}
else {
PurchPurchaseOrderTmp.MGALabelIdString = "";
}
Here is my report design row grouping:
Thanks
This is not really an answer at the moment as I can't see enough to be certain but...
Looking at the report design, it 'appears' that you don't have anything in the details row(s). The details group rows have been reduced in height so I'm guessing there is nothing in there.
That means that the text boxes below this must be in a group header or footer which is why they will only appear once.
The best way to get your head round this is to dump all the data from your dataset into a simple flat table, then see what you want repeating.
For exmaple, it looks like Label ID (MGAItemLabelName ?) should only be shown once, so there needs to be a group for that - which it looks like you have.
Then within that label name group, you have two rows of data that you want to show, so these must be at a lower level than their parent group. That might be the details row group, or another row group between the header and details depending on your needs.
The details row group typically contains fields that you want to show every instance of and that does not have any subordinate/child data.

SSRS - Display a text based on first row value

I am trying to write an expression, If the result-set's first row values is equal to 1 then display a text. I am not sure how to get first rows value. Can someone help me out to achieve the same.
=IIF(Fields!IsAccessAvailable.Value=1, "You have full access to this page","")
=IIF(First(Fields!IsAccessAvailable.Value, "YourDatasetName")="1",You have full access to this page","")
You could also add the same expression as Textbox Visibility, so that if Fields!IsAccessAvailable.Value = 1 then and then only this textbox will be shown else it will hide it.

SSRS - Textbox Linebreak (or) Linking Table w/ Textbox

My SSRS report contains 4 tables, all of which have line breaks at the bottom.
I'm trying to find a way to tie my text boxes (titles for each table) to only show up on the first page of the start of each table. I'm honestly at a loss for this particular issue.
--Unrelated --
Originally I had a parameter with a visibility expression and a toggle option to switch between each table, but due to a recent change request the entire report needs to be on one screen.
(=IIF(Parameters!SelectAScreen.Value = "InvoiceDetails",false,true))
I think if you add an extra row above your data (outside the group) and set the RepeatOnNewPage to False, it should work the way you want it too.
Some version of #StevenWhite's comment above is the only way I know to do this. One way to do it is to do a union with a dummy key to force the title row to the top of each table:
select 1 as dummyKey,
'Title text for table1'
union all
select 2 as dummyKey,
<columns> from <table1>
order by dummyKey, <other sort columns>
and repeat for each table's dataset.
If necessary you can also do conditional formatting to make the title row stand out and look like a title.

ssrs 2008 R2 show/hide not working on expression

I have this problem, which I have already googled,searched on stack overflow and tried every possible solution that I could found on the internet.
I have a table like this:
When the table is initally loaded the value are not visible and have to be toggled by Filter
After I click on the value, the dataset is filtered, and the Filter group will contain only 1 Value (the one that was selected) after the report reloads.
With an expression I made the left side look orange like the following, if only 1 value in a group exists :
Now I would like to also show the value on the right, but it does not work with all expressions i tried on text box level and/or group level :
=IIF(Fields!filter.BackgroundColor = "Orange" ,false,true)
=IIF(Fields!filter.BackgroundColor <> "Orange" ,true,false)
Can someone help Please ?
After days of trying in different ways, the only working solution was to add an extra column to my dataset called "hidden". If a filter value is the only value counted (grouped by filter) then put a 0 in the hidden field ,else 1 which results in something like :
Filter Value Hidden
A B 1
A C 1
B A 0
After that, on the text field Hidden Value i used expression
=CBool(Fields!hidden.value)
This Worked Great!

How to get the max of a sum?

Can anyone tell me how do I get the Max of a calculated field? Below is an image of my situation:
Note that Flag is of type int.
I want to write the expression in the image , but when I use it, it kinda does:
Sum(Sum(Fields!Flag.value))
Can anyone help me out on this. I think I need to add scope for the Sum(Flag) but when I add the group scope as EMPID as:
=iif(SUM(Fields!Flag.value,"Fields!EmpID.Value")>2,"RED",nothing)
It throws me an error saying something about the scope.
EDIT:
I need attendance of each employees. FLAG is basically 1 if absent and 0 if anything else.
The bottom row(Flag,Date,Status,Comment). Now I have an alert There:
=iif(Fields!Flag.Value=1,"RED",Nothing)
Beside the Textbox(Textbox62) in middle row(EmpID,EmpName) I did Expression:SUM(Flag) and in the Fill section in Text Box Properties i have done:
=iif(SUM(Fields!Flag.value,"Fields!EmpID.Value")>2,"RED",nothing)
So the above expression creates an alert if employee is absent more than 3 days.
The top most row(Department,Manager) can be drilled down for to see more detailed view of the report. Now my problem is, in the column (FLAG) i need to create a Background color change if any employee in a particular department is absent more than 3 days.so that we do not have to drill down all the departments in order see if any employee is absent or not.
So my approach was to see the Max(Sum(Flag))>2 then create color change. I tried:
=iif(MAX(Sum(Fields!Flag.Value))>2,"Red",Nothing)
It does not work at the Department level as it basically considers (SUM(Sum(Flag))).
Thanks................
If you don't specify the scope of an aggregate, it is assumed that you are using the current scope. For example, when you say
Sum(Fields!Flag.value)
It is interpreted as something like
Sum(Fields!Flag.value, "EmpID")
The scope is the name of the Group, not the name of a dataset field.
Depending on where it is in the table. When you want to say something like
Sum(Sum(Fields!Flag.value))
You need to specify the scope for each one that isn't going to be the current default.
In your case you should use something like this:
=iif(MAX(SUM(Fields!Flag.value, "EmpID"), "Department")>2,"RED",nothing)
Again, pay attention to which group each aggregate is referring to and where the expression is on the table.
Also, this expression in a textbox will just make the word "RED" appear in the box. If you want it to change the color, you have to put it in the "Fill color" expression in the properties.