In Rdlc report because of row grouping serial no not getting linewise

I have created one rdlc report in BC. There are one header(Sales Header) and two line table(Sales line & one custom line table). In layout row grouping is created because of this grouping Serial No is not getting linewise. It is shuffling. I tried with RowNumber(Nothing) expression and also tried with creating Serial no. variable and calling in onaftergetrecord of line but this two also not working. How to resolve this. Below are given indentation.
SalesHeader
{
Sales Line
{
}
Custome table line
{
}
}

It seems like the issue you are facing is related to the row grouping in your rdlc report in Business Central. As you mentioned, the Serial No is shuffling due to the grouping.

To resolve this issue, you can try the following steps:

  1. Remove the row grouping in the report and run it to check if the Serial No is appearing correctly. If it is, then the issue is definitely related to the row grouping.
  2. If you need the row grouping in your report, then you can try adding a parent group for the Sales Header table and then add the Sales Line and Custom table line as child groups under the Sales Header group.
  3. Within each child group, you can use the RowNumber function to generate the Serial No. You can use the following expression in the text box where you want to display the Serial No:

=RowNumber(Nothing)

  1. You can also try using the RunningValue function to calculate the Serial No. For example, you can create a variable in the report and set its initial value to 1. Then, in the onAfterGetRecord trigger of the Sales Line and Custom table line, you can set the value of the Serial No variable to the RunningValue of the variable plus 1. Finally, you can use the variable to display the Serial No in the report.

I hope these suggestions help you resolve the issue you are facing with the Serial No shuffling in your rdlc report.