Nested array object fields not visible/accessible

4 posts, 0 answers
  1. Casper
    Casper avatar
    11 posts
    Member since:
    May 2019

    Posted 14 Aug Link to this post

    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

  2. Silviya
    Admin
    Silviya avatar
    414 posts

    Posted 19 Aug Link to this post

    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
  3. Casper
    Casper avatar
    11 posts
    Member since:
    May 2019

    Posted 19 Aug in reply to Silviya Link to this post

    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

  4. Silviya
    Admin
    Silviya avatar
    414 posts

    Posted 20 Aug Link to this post

    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
Back to Top