If have an rdlc-report with grouped columns within a tablix (table). I want to add a footer row that spans all dynamically created columns and shows a total for all columns together.
How can I tell to a cell that it should span all created columns created by the group?
|-------|-------|-------|
| col 1 | col 2 | col 3 |
|-------|-------|-------|
| Column-Group Total |
|-----------------------|
Please note, calculating the total is not my problem. I'm only searching for a way to tell report viewer to merge cells that are created automatically through a column-group for a specific row.
Update
Sadly, up to now, I have not found a solution to this. Moreover the same question I also have encountered in a report where I had to add totals of a row-group in a merged column.
|------|-------|
|row 1 | |
|------| Row- |
|row 2 | Group |
|------| Total |
|row 3 | |
|------|-------|
I find this a quite common way of showing totals. Is this not possible in either way or am I missing something obvious?
Update2
Here a screenshot of what I mean:
In the middle there is a group. This creates at runtime n columns. What I want to do is the "spanning category total" to span all dynamically created columns. This means, that the columspan of the cell is n. There is only one cell and in this cell I will show the total of all categories. It's quasi the same as report viewer creates automatically at the top of the group.
Don't know if you've found an answer to this, yet, but if not...
Usually, totals are expected in the last column for data grouped in columns and the last row for data grouped in rows...
However, depending on the scope, and the level of grouping you have, you might be able to achieve what you want by embedding your tablix into an outer tablix, and then adding a row to the outer tablix that sums the data there.
I have used multiple data regions within rectangles and lists to manipulate all kinds of layouts. You just have to play around with scopes, and possibly adjust your output data (sums/averages by groups in stored procedure) if those scopes just aren't cooperating. Let me know if it solves your problem.
As I know, rdlc are report files you edit on Report Wizard or visual studio as opposed as rdl that are report files being developed on BIDS.
I don't know if this will work on rdlc files because I only use BIDS, but I think its worth the try:
on the row groups tab (botton left) right click on your group and
select add total -> after, it will add a total row.
temporarily copy the sum cell (the total) to some other place on the
report (because the next step would erase it if you dont)
using SHIFT, select cell by cell on the row you want to merge (don't
select the row itself)
right click it and select merge cells
paste the sum cell you copied away on step 2
Result (I hope you can see):
EDIT:
answering your question, yes I'm sure it can be done because I did it several times and also you saw on the print screen.
I'm pasting the XML for my row, I think the secret is on the <ColSpan>8</ColSpan> tag. I do have 8 columns on my report.
<TablixRow>
<Height>0.25in</Height>
<TablixCells>
<TablixCell>
<CellContents>
<Textbox Name="textbox18">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Sum(Fields!myField.Value)</Value>
<Style>
<FontFamily>Tahoma</FontFamily>
<FontSize>9pt</FontSize>
<Format>'$'#,0.00;('$'#,0.00)</Format>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>textbox16</rd:DefaultName>
<Style>
<Border>
<Color>LightGrey</Color>
<Style>Solid</Style>
</Border>
<BackgroundColor>White</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<ColSpan>8</ColSpan>
<rd:Selected>true</rd:Selected>
</CellContents>
</TablixCell>
<TablixCell />
<TablixCell />
<TablixCell />
<TablixCell />
<TablixCell />
<TablixCell />
<TablixCell />
</TablixCells>
</TablixRow>
Since it looks like you have a dynamic column group, you will probably put into the columns:
Fields!ColHeading.Value |Total
Fields!DataValue.Value | =SUM(Fields!DataValue.Value)
If you prefer the graphical interface, right click on the total's value field and click on Expression. In the popup, expand the Common Functions and click on Aggregate and in the Item window, double click on Sum. Type in or click the data field and you will get something like this:.
Hit Ok, and you are good to go!
Related
I am modifying a legacy SSRS report (rdl file); I've added four columns to it, and am supplying those values by means of a new data source (Stored Procedure).
However, now when I try to run the report via the "Preview" tab, I get:
An error occured during local report processing.
The Group expression used in grouping 'table1_Group1' returned a data type that is not valid.
" [ a second err msg identical to the one above ] "
There is indeed a Row Group named "table1_Group1", and its properties look like this:
I don't know why NewBiz is suddenly a problem; nothing has changed about it, and there was no complaint concerning it previously.
"NewBiz" does (still) appear in the filed list in the "Dataset Properties" pane (both Field Name and Field Source are "NewBiz"); the data source (stored proc) does return it. So...?!?
NOTE: The "table1_Details_Group" beneath "table1_Group1" has no Group Expression, and thus seems to have no raison d'etre; unless I'm misunderstanding something about its role/purpose.
UPDATE
Alan Schofield raised the question over whether the dataset fields "are in the order expected."
So I examined that under a fine-toothed microscope. This is the last part of the data source/stored procedure, which returns the values:
select CY.CSDirector, CY.Category, CY.Segment, CY._Unit,
CU.New, CU.Assumed, CU.Existing, CU.Organic,
CY.NumUnits, CY.NumUnitsLast, CY.MonthSales, CY.MonthSalesLast,
CY.MonthPerc, CY.YTDSales, CY.YTDSalesLast, CY.YTDPerc,
CY.ProjSales, CY.YTDProjSales, CY.YTDBudgetPerc, CY.NewBiz
from #CombinedYears CY
left join #CategorizedUnits CU on CU.Unit = CY._Unit
And this is what I see in the Report Data pane for the data surce:
So the first possible discrepency is in that "_Unit" is seen as "ID_Unit" for some reason in the Dataset. Why would that be? Does SSRS automatically convert "" to "ID"? If this is a known gotcha, it is as yet unkown to me.
After that all Dallas breaks loose, as the order of fields diverge radically. Why? Shouldn't the Refresh have ordered them alike? How can I get them to straighten up and fly right, or manually change the order so that they match?
NOTE: I'm not sure if this should even matter - should it? Are the field values populated based on position rather than by field name? IOW, must they match up, positionally?
UPDATE 2
This woke me up to the fact that there are up/down arrows; I'll try that...
UPDATE 3
I changed the order of the fields in the list to match those returned from the stored procedure, but it made no difference - I still get the same err msg when I try to generate the report.
UPDATE 4
In the rdl file the group expression that is supposedly problematic is this:
<TablixRowHierarchy>
<TablixMembers>
<TablixMember>
<KeepWithGroup>After</KeepWithGroup>
<RepeatOnNewPage>true</RepeatOnNewPage>
<KeepTogether>true</KeepTogether>
</TablixMember>
<TablixMember>
<Group Name="table1_Group1">
<GroupExpressions>
<GroupExpression>=Fields!NewBiz.Value</GroupExpression>
</GroupExpressions>
</Group>
<TablixMembers>
<TablixMember>
<KeepWithGroup>After</KeepWithGroup>
<KeepTogether>true</KeepTogether>
</TablixMember>
<TablixMember>
<Group Name="table1_Details_Group">
<DataElementName>Detail</DataElementName>
</Group>
<TablixMembers>
<TablixMember />
</TablixMembers>
<DataElementName>Detail_Collection</DataElementName>
<DataElementOutput>Output</DataElementOutput>
<KeepTogether>true</KeepTogether>
</TablixMember>
<TablixMember>
<KeepWithGroup>Before</KeepWithGroup>
<KeepTogether>true</KeepTogether>
</TablixMember>
</TablixMembers>
</TablixMember>
<TablixMember>
<KeepWithGroup>Before</KeepWithGroup>
<KeepTogether>true</KeepTogether>
</TablixMember>
</TablixMembers>
</TablixRowHierarchy>
...to be more specific, this:
<Group Name="table1_Group1">
<GroupExpressions>
<GroupExpression>=Fields!NewBiz.Value</GroupExpression>
</GroupExpressions>
</Group>
Why would that be a problem? NewBiz is a value contained in the result set, and it has two values by which it could be grouped (-1, signifying "New", and 0, signifying "Existing").
So why the err msg?
That field itself is represented in the rdl file like so:
<Field Name="NewBiz">
<DataField>NewBiz</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
UPDATE 5
And now it's working, with now change to the code...this happens too often with this old technology, and I don't know whether to be more relieved or irritated when something that doesn't work all of a sudden starts working WITH NO CODE CHANGES. Why!?? Arghhhh!!! Gleeeep!!! (that last was a happy sound, more-or-less equating to the polar opposite of argh).
I had a similar problem. I had a chart being fed by a 3-column query, one of which was an aggregate (ID Code, Sum(Count), and Day - in that order). What I did to fix it was to put the field I was grouping by earlier in my query (i.e. Day, ID Code, and Sum(Count)), that seemed to do the trick. It seems kind of stupid... but there it is.
I'm working on converting an RDL report to an RDLC. The RDL contains a row group. However, the row group doesn't appear to actually be grouping on a field.
As seen here, a group expression doesn't appear to be specified.
However, in the Sorting tab, there's a "Sort by" specification, shown here.
Looking at the XML in the RDL file, here's the row group:
<TablixMember>
<Group Name="table8_Details_Group">
<DataElementName>Detail</DataElementName>
</Group>
<SortExpressions>
<SortExpression>
<Value>=Fields!Dated.Value</Value>
</SortExpression>
</SortExpressions>
<TablixMembers>
<TablixMember />
</TablixMembers>
<DataElementName>Detail_Collection</DataElementName>
<DataElementOutput>Output</DataElementOutput>
<KeepTogether>true</KeepTogether>
</TablixMember>
So, my question is: Why would a row group be added to a report, which doesn't group rows on a field? It appears that the only purpose of this row group is to sort rows based off of the "Dated" field. Am I missing something? It strikes me as odd that a "row group" would be added to a report, which doesn't group any rows, and only sorts them.
This is normal. Even the detail row of a report tablix has a group associated with it. It just doesn't group anything. If you change that, the display of the details will be affected, and probably not in the way you want, either.
The sort setting is just that, it tells the report how to sort the detail rows. There is nothing wrong here.
I have a report that is acting very strangely. I thought originally the report might be corrupt somehow but was able to recreate the problem starting from scratch.
Basically, I have two datasets which both call different procs that have no connection with each other. When run through TSQL they always produce the correct results.
If I add a table to the report and show one field in a table belonging to dataset1 without adding dataset2 to the report, it always returns the correct results. However, if I then add the second dataset to the report, it will sometimes return the correct result and then on other runs return a purely random value, which is not returned by either proc.
None of the fields in either dataset have the same name. The problem is always related to the Money datatype for some reason.
Anybody any ideas what could possible be going wrong?
For Example, I've checked this with sql profiler so the correct parameter is getting passed to the proc in tsql.
I'll call proc _ proc_rpt_Test1
which will return a field called DiscountedTotalCustomerPrice. This is defined as money type in the proc. It will return a value of say 16,000 through tsql for Audit1
This field does not exist in the other dataset. I've set the table equal to dataset1 so it should not be referencing the second dataset in anyway.
So the first time you run, you will get 16,000. However the second time you run it might return 22,528, the third time 55,260. These numbers are from the previous three runs. The values being returned are not a multiple or anything, and I'm just displaying the number.
Been working with SSRS for years, and never had such an issue.
Datset 1 fields are
TotalLineItemsCount,TotalKwhSavings,NETTotalKwhSavings,TotalKwSavings,TotalKwhSavingsDollar,TotalPrice,TotalCustomerPrice,TotalUtilityPrice,CustomerDeposit,DiscountedTotalCustomerPrice,DiscountedCustomerBalance,CustomerBalance,TwelveMonthPayment,TwentyFourMonthPayment,SimplePayback,TotalKwBefore,TotalKwAfter,TotalKwhBefore,TotalKwhAfter,DatePayback,MonthlyCostOfDelay,PaybackInMonths,TotalCost,TotalMargin,QtyBeforeFixtures,QtyAfterFixtures,CurrentAnnualCost,SixMonthPayment
The second dataset was
AuditID,Incentive,DefaultDeposit,DefaultDiscount,CustomerLumpSum,MaxMonthlyPayment,CashFlowFactor,ProposedDate,MonthlyInterestRate,RawNumberofPayments,FinalNumberOfPayment,CustomerMonthlyPayment,TotalCustomerPayment,PaymentIncrements,MaxNumberOfPayments,MinNumberOfPayments,CustomerDeposit,CustomerDiscount,ActualLaborType
XML if the rectangle..as asked for
<Rectangle Name="Rectangle2">
<ReportItems>
<Textbox Name="DiscountedTotalCustomerPrice">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Sum(Fields!DiscountedTotalCustomerPrice.Value, "AuditSummary")</Value>
<Style />
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>DiscountedTotalCustomerPrice</rd:DefaultName>
<Top>0.33958in</Top>
<Left>1.17014in</Left>
<Height>0.25in</Height>
<Width>2.4375in</Width>
<Style>
<Border>
<Style>None</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
</ReportItems>
<KeepTogether>true</KeepTogether>
<Top>0.4925in</Top>
<Left>0.04736in</Left>
<Height>0.8325in</Height>
<Width>8.04682in</Width>
<ZIndex>7</ZIndex>
<Style>
<Border>
<Style>None</Style>
</Border>
</Style>
</Rectangle>
From the xml for dataset
<Field Name="DiscountedTotalCustomerPrice">
<DataField>DiscountedTotalCustomerPrice</DataField>
<rd:TypeName>System.Decimal</rd:TypeName>
</Field>
I'm using ReportingService 2010 and im trying to get multiple reports into one file on sperate pages. The problem is the order of the pages.
At this point I have a table for each of my datasets on seperate pages. Export to Excel works great, but the order of the pages (Web View and Excel Worksheets) doesn't match the order of my Tablix elements of the rdl file.
Setup is like:
..
<DataSets>
Dataset Name="A"
Dataset Name="B"
Dataset Name="C"
</DataSets>
..
<ReportItems>
<Tablix Name="A_Tablix">...<PageBreak><BreakLocation>End</BreakLocation></PageBreak></Tablix>
<Tablix Name="B_Tablix">...<PageBreak><BreakLocation>End</BreakLocation></PageBreak></Tablix>
<Tablix Name="C_Tablix">...<PageBreak><BreakLocation>End</BreakLocation></PageBreak></Tablix>
</ReportItems>
...
But the pages seem to appear like random, and not in the order of the rdl file. Is there any element I'm missing? Or how do I have to order the Tablix elements of the code to get the same order in the Web View and Excel Worksheets?
I found the answer, after some experimentation...
The problem was, that the Tablix were overlapping. They started at Top 0 and Left 0. It works as expected, after I added an offset according to the desired position to the Top value like:
x*Height of Tablix
I have a grid view like so:
<GridView ItemsSource="{Binding Source={StaticResource GroupedMatches}}"
SelectionMode="None"
ItemClick="OnItemClicked"
IsItemClickEnabled="True"
Grid.Row="4"
Grid.Column="1">
<GridView.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</GroupStyle.HeaderTemplate>
</GroupStyle>
</GridView.GroupStyle>
</GridView>
GroupedMatches is a CollectionViewSource in the page:
<CollectionViewSource x:Name="GroupedMatches"
Source="{Binding Matches}"
IsSourceGrouped="True"
ItemsPath="Matches" />
Its backing view model is a class with Name and Matches properties where Matches is an IEnumerable.
When the above is rendered with three items spanning two groups, only two of the items are rendered. If I remove the GridView.GroupStyle then all three items are rendered as expected. Does anyone know what might be causing the item to be culled when headers are present?
Edit: Following up I have discovered that the second group (in which items are not appearing as expected) seems to have its size match the first group. So if the first group has two items in it the second group will show two items. If the first group has three items the first group will show three, and so on. For now I have opted to change the layout to more closely reflect the default grid layout mentioned by Filip, but have not been able to determine why the two groups' sizes are linked.
Hi Alex (I believe we'd met before). In addition to what Jim said (does each of your Matches represent an object with a Name and another nested Matches property?) you might run into an issue where if you don't specify the GroupStyle.Panel - you will get a default StackPanel which might get some items in your grouped collection clipped. When you create a default "Grid App (XAML)"-template based application - you get the following definition of the group panel:
<GroupStyle.Panel>
<ItemsPanelTemplate>
<VariableSizedWrapGrid
Orientation="Vertical"
Margin="0,0,80,0" />
</ItemsPanelTemplate>
</GroupStyle.Panel>
Now if you comment that out - your groups will change from this
to this