Odd behavior in Group Invoice AR Report

We have recently made a few minor changes to our AR Invoice report (SSRS) and since then there’s been some odd behavior when printing groups of invoices. When printing invoices in groups there are (seemingly) random invoices that have lines with incorrect information:

This is what it should look like:

It doesn’t affect every invoice in the group or even every line on the invoices that are wrong. Also, every one of them that shows as wrong in the group is correct when printed individually (same report style for both).
Has anyone run into anything like this? Is there some difference in the way a group is passed to print than a single invoice?

1 Like

If print the same group multiple times is the issue always with the same lines?
What happens if you use the base RDL?

Did you modify the main dataset query?

It could be a bug but if you are on it makes it a bit more difficult to track it down considering this is one of the most modified reports.

This is an old post but I’ve finally been able to get back around to working on this issue. I believe I have figured out the problem but I’m having some difficulty with the solution. Our invoices are grouped by part number so I use the following code to get the total from each individual line:
Dim invoiceLines As System.Collections.Hashtable
Function MyFunc(ByVal invoiceLine As Object) As integer
dim flag as integer
If (invoiceLines Is Nothing) Then
invoiceLines = New System.Collections.Hashtable
End If
If (Not invoiceLines.Contains(invoiceLine)) Then
flag = 1
invoiceLines.Add(invoiceLine, nothing)
flag = 0
End If
MyFunc = flag
End Function

Then in the field on the report I’m using this:
=FormatNumber(sum(val(iif(Code.MyFunc(Fields!InvoiceLine.Value) = 1, Fields!SellingShipQty.Value, 0))), 2)

I’ve discovered the reason that this works when printing individual invoices and not groups is that it is not distinguishing between each invoice in the group so it leaves out the total of each line that is the same line number on the previous invoice in the group. For example, I have 2 invoices in a group. The first one has 2 lines and the second one has 3 lines. It will leave out the amount of the first 2 lines on the second invoice in the total.

SSRS coding is not really my forte so I’m not really sure how to make it take each individual invoice into account when doing this. Any advice would be appreciated.

Visual Basic is not really my forte either so I would need to look this up, but what you should basically do is combine both Invoice Number and Invoice Line and add that to the Hashtable.

So maybe change this
Function MyFunc(ByVal invoiceLine As Object) As integer
To this
Function MyFunc(ByVal invoiceNumber As String, ByVal invoiceLine as String) As integer

And do something like
If (Not invoiceLines.Contains(invoiceNumber + invoiceLine))
invoiceLines.Add(invoiceNumber + invoiceLine, nothing)

1 Like