This is a migrated thread and some comments may be shown as answers.

Nested array object fields not visible/accessible

3 Answers 888 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
Casper
Top achievements
Rank 1
Casper asked on 14 Aug 2019, 08:59 AM

Hi,

Today it is not possible to display/consume object fields from a nested array (as far as I can see).

MyDataSet
- field1 (int)
- field2 (string)
- field3 (int)
- field4 (object)
-- field4_array (object)
---- field4_1 (int) (not visible/accessible)
---- field4_2 (int) (not visible/accessible)
---- field4_3 (string) (not visible/accessible)

This means the fields of field4 (array) are not visible or accessible in the report designer.
The only way to access this data, is to make a new dataset, with (field4_array) as root,
but that is not preferable.

 

Could this potentially be implemented in upcoming versions?

 

Cheers,
Casper

3 Answers, 1 is accepted

Sort by
0
Silviya
Telerik team
answered on 19 Aug 2019, 06:02 AM
Hi Casper,

When there is hierarchical data inside a data field, Telerik Reporting does not drill down automatically to get the inner object schema. To show this data you can use a nested Data Item such as Table or List and bind this data item to the data field collection using a Binding.

In your case the returned data from the WebServiceDataSource is wrapped in object named field4_array. You can add binding rule to the table with the following:
Property path: DataSource
Expression: =Fields.field4_array

to access inner fields.

As of R2 2018 12.1.18.718 Internal build WebServiceDataSource supports JSON data selection using JSONPath to filter JSON data. More information could be found in How to: Use JSONPath to filter JSON data help article.

Best Regards,
Silviya
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Casper
Top achievements
Rank 1
answered on 19 Aug 2019, 07:51 AM

Hi Silviya,

Thanks for your reply.
Nice to see that binding makes it possible to set the inner array as data source.

The only thing I'm missing here, is to visually see the fields available for this bound data source.
Would be great if they could be visible in the Expression Editor or in the Data Explorer.

I'm using the new JsonDataSource available in 2019 R2.

Best,
Casper

0
Silviya
Telerik team
answered on 20 Aug 2019, 10:07 AM
Hi Casper,

We support enumerating inner properties of complex structures in JsonDataSource. However, the property field4_array is actually an array of object instances:
{
    "field1": 1,
    "field2": "test",
    "field3": 2,
    "field4": {
        "field4_array": [{
            "field4_1": 3,
            "field4_2": 4,
            "field4_3": "test2"
        }]
    }
}

which makes it impossible to determine the inner properties. For example, it is not the same as the class Person which has a property of type Address - in this case the Person would have IList<Address> and that wouldn't work for expanding inner properties either.

The complex objects are actually resolved correctly by JsonDataSource and it can be expanded and accessed in Data Explorer as expected.:
{
    "field1": 1,
    "field2": "test",
    "field3": 2,
    "field4": {
        "field4_array": {
            "field4_1": 3,
            "field4_2": 4,
            "field4_3": "test2"
        }
    }
}

Best Regards,
Silviya
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Report Designer (standalone)
Asked by
Casper
Top achievements
Rank 1
Answers by
Silviya
Telerik team
Casper
Top achievements
Rank 1
Share this question
or