Using JSON(Javascript Object Notation) datasource send data from .Net Core
Hi,
I create a list from person class that using .Net Core 5.0. and send to report but fastreport consists of a single line from the first element of the list.
List<Person> data = GetDummyData();
Report report = new Report();
report.Load("C:\\Users\\testyazilim\\Desktop\\PersonJsonTest.frx");
report.RegisterData(data, "JSON.item");
report.Prepare();
The json format I use is as follows; and json schema is created automatically.
{
"Id": {
"type": "integer"
},
"Name": {
"type": "string"
},
"Surname": {
"type": "string"
},
"Age": {
"type": "integer"
}
}
the report is generated successfully but only from a single line, although I use a table in ".frx" report. I used many different versions of json, but the result was the same.
I use FastReport Community.
This discussion has been closed.
Comments
https://github.com/FastReports/FastReport/issues/281
Hello!
When you pass a `List<Person>` via `report.RegisterData(data, ‘JSON.item’)` in a template designed for a JSON schema (or without an explicit `DataBand.DataSource` binding), only the first item in the list is displayed because the `DataBand` is not bound to a data source or the field path in the `TextObject` does not match the registered name.
A working solution in .NET 8:
And use [Person.Name] and [Person.Age] in the fields. If a JsonDataSourceConnection is already configured in the .frx file, pass the JSON string directly to the connector’s ConnectionString (JsonDataSourceConnection) without mixing it with a List<Person>