Report List element adding "empty" elements at the end

1 Answer 85 Views
Rendering
Xiacon
Top achievements
Rank 1
Xiacon asked on 16 Jun 2023, 09:09 PM

We have a report which has a List element in it.

The whole report is bound to a .NET list of a data-class. The class has a property which is .NET list of a different data-class. 

For some reason, this List is adding extra "empty" items at the end of our actual data.

For example,

In the above screenshot, the list to which the List is bound, has only 4 items (the red arrow is where i'm putting out the dataList.Count).

Yet you can see that after putting out the 4 valid data items, it then added two additional empty items with no data in them ($0 by 1/1/1).
Why it is adding extra items that are NOT in the dataList, and how do we get it to stop that? Those last two items should just be empty, nothing there, no text. So the List SHOULD be generating an output that looks like this:

1 Answer, 1 is accepted

Sort by
1
Accepted
Momchil
Telerik team
answered on 21 Jun 2023, 12:18 PM

Hello,

I see that you have opened a support ticket regarding the same issue.

I have posted a technical response in the thread of the aforementioned ticket but I will provide a summary of my reply here as well in case anyone else is facing a similar issue.

I noticed that in order to get the "three records per row" layout, you have applied the following groupings to the List.

When you have 4 records, this will essentially create a table with 3 columns and 2 rows. However, the last 2 cells have no corresponding data records and the expression returns an unexpected result for them.

To work around this, you can modify the expression in the List's text box so that it "ignores" NULL data. For example:

= If(Fields.Amount Is Null, "", Fields.Amount + " by " + Fields.DueBy + Iif(Fields.CollectedInCourt, " *", ""))

I hope this helps.

Kind Regards,
Momchil
Progress Telerik

Stay tuned by visiting our roadmap and feedback portal pages, enjoy a smooth take-off with our Getting Started resources, or visit the free self-paced technical training at https://learn.telerik.com/.
Xiacon
Top achievements
Rank 1
commented on 21 Jun 2023, 05:23 PM

Yup! That worked perfectly. I wouldn't expected it to, since .Amount is not a nullable type, but I guess the reporting engine must be handling that internally somehow.

Thanks for your help!

Tags
Rendering
Asked by
Xiacon
Top achievements
Rank 1
Answers by
Momchil
Telerik team
Share this question
or