Using List<> as datasource


just struggling to use a generic List as datasource and couldn't find an example in sample\csharp . How to declare the cell reference inside the named range?

For example I registered the datasource like:

List<double> result_tbl = new List<double>();

Report.AddTable("Result", result_tbl);

What is the syntax for the cell declaration, because the list has no fieldname?


Best regards

As you've pointed out, the reports won't work with a list of doubles, they require a list of records or classes.

And the reason we don't allow a list of primitives (strings, doubles, etc) is mostly because we didn't thought it could be useful, and nobody until now requested it either :slight_smile: But now that we have one request, we will study if it can be done. I think the syntax for such a feature should be just <#Result>, but maybe there is a need to require something like <#result.value> or something like that for the report engine to like it.

The workaround as you probably already figured is to have a record with a single "data" field and then have a list instead of a list. But if you already have the existing list of doubles, filling one from the other is not very efficient.

As said, we'll see if it can be implemented, and I will let you know.


thank you for your quick response. From my side its totally ok to work with a list of simple objects/structs which are containing numeric values. Copying the values into another list takes just a few milliseconds.

I only asked, because the documentation says, that I can use any datasource which implements IEnumerable interface. I thought I miss something to make it work with a simple List of primitives.

Best regards

We've just added the possibility to use list, string, bool, and ints directly. The syntax will be <#Result.value> (because without the ".something" part it would be confused with a property).

It will be available in the next release

1 Like