SSRS Independent datasets conflicting with each other - reporting-services

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>

Related

In SSRS Report table is there a way to have two sets of repeating groups?

Is there a way to add two child groups to a SSRS Report table where both repeat all row details? The In this report I get all the check in times but only one checkout time. I'm hoping to have a list of both organized by Supplier ID.
I was able to do this but not using the Editor. I edited the rdl as a text file and added the following inside below the TablixMember for Group Name=SupplierID #2.
<TablixMember>
<KeepWithGroup>After</KeepWithGroup>
</TablixMember>
<TablixMember>
<Group Name="Details4" />
<TablixMembers>
<TablixMember />
</TablixMembers>
</TablixMember>
<TablixMember>
<KeepWithGroup>Before</KeepWithGroup>
</TablixMember>
</TablixMembers>
</TablixMember>
This gave me the following groupings:

Why is an existing field that has not changed be suddenly considered to have an invalid data type?

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.

Remove empty values from CSV in Reporting services

how i can remove empty value when i export my SSRS report into CSv format.
For example i got
PlayerId,F1,F2,Date,F3,F4
,,,,,
when my report is empty and i exported it to csv format
MyReport
Try to manipulate with visibility of rows. I reproduced your issue and solved it hiding rows if there is no data.
Right-click on row handle and select Row visibility:
and then set expression for Hidden property:
=Fields!PlayerId.IsMissing
Then, if value for this field will be missing, whole row will be hidden. If you need, you can make more complex expression, checking additional fields. If you need to hide rows only when exporting to CSV, you can do this:
=Globals!RenderFormat.Name = "CSV" And Fields!OrderId.IsMissing
In case of your file the element
<TablixMember>
<Group Name="Details" />
</TablixMember>
should be
<TablixMember>
<Group Name="Details" />
<Visibility>
<Hidden>=Fields!PlayerId.IsMissing</Hidden>
</Visibility>
</TablixMember>

RDL report - Row Group without a Group expression

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.

How to create totals row for grouped columns

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!