Hi,
I'm having trouble with conditional grouping of a tablix in a NAV RDLC layout.
If the SalesInvoiceLine type is an Item, I want to group based on the No. If the type is something else (general ledger) I don't want to group and just display every line.
The group on expression I'm using is:
=IIf(Fields!Type_SalesInvoiceLine.Value = "Item", Fields!No_SalesInvoiceLine.Value, "")
But this isn't working. Can someone help me find the correct way?
Thanks!
Answers
So you could try to add code to the report, OnAfterGetRecord, something like IF ... THEN GroupIt := TRUE ELSE GroupIt := FALSE where GroupIt is a boolean variable also added to the dataset somewhere in the lines.
But my best guess would be that it is not going to work this way. You could perhaps experiment with adding both grouped and not grouped lines and FILTERING on this field. Maybe it works.
I think I would probably stick to doing it all on NAV side as it is more testable and easier (for me). I would probably turn the sales invoice line into a temp table and write code to fill it out conditionally, copy item lines into it 1:1 while copy other lines summed up. So then the report runs on a sales inv line temp table that is already correctly filled out and no RDLC side logic is needed.
So if the SalesInvLine of type Item is (or Artikel in Dutch), the grouping is done by Item No.
If these are not true, grouping is done by LineNo.