Forum Discussion

JanRak's avatar
JanRak
Helper I
2 years ago
Solved

Capabilities.json - two grouping dataRoles, but each to handle different sizes of arrays.

Hi

I'm not sure if I'm doing something wrong, or is it an API limitation.

I've created two fields for the custom visual.
Let's say one field will be populated by a column consisting of 400 elements.
The other field will be populated by a column from a different table consisting of e.g. 50 elements.
When I apply the following and log the dataview, both arrays consist of 50 elements (meaning one got truncated to the size of the smaller array).
Is there a nice way to get both full arrays into my visual?

Here's my capabilities.json file:

 

 

 

{
    "dataRoles": [
        {
            "displayName": "Column 400",
            "name": "column400",
            "kind": "Grouping"
        },
        {
            "displayName": "Column 50",
            "name": "column50",
            "kind": "Grouping"
        }

    ],
    
    "dataViewMappings": [
        {
            "categorical": {

                "categories": {
                    "select": [
                        
                        { "bind": { "to": "column400" } },
                        { "bind": { "to": "column50" } }
                    ]
                }
            },
            "conditions": [
                {
                    "column400": {
                        "max": 1
                    },
                    "column50": {
                        "max": 1
                    }
                }
            ]
        }
    ]
}

 

 

 


Cheers
Jan

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi JanRak,

    Perhaps you can try to use the following code if it works:

    {
        "dataRoles": [
            {
                "name": "Group1",
                "kind": "Grouping",
                "displayName": "Group 1",
                "description": "role group with 400 elements"
            },
            {
                "name": "Group2",
                "kind": "Grouping",
                "displayName": "Group 2",
                "description": "role group with 50 elements"
            }
        ],
        "dataViewMappings": [
            {
                "conditions": [
                    {
                        "Group1": { "min": 1, "max": 400 },
                        "Group2": { "min": 1, "max": 50 }
                    }
                ]
            }
        ]
    }

    Regards,

    Xiaoxin Sheng

    • JanRak's avatar
      JanRak
      Helper I

      Thanks Anonymous 
      I'm afraid this isn't the solution.
      Conditions min/max allow to specify the number of data fields that can be placed in a particular data role. So if I set Group1 condition as max 400 that means I can drag 400 columns into that field

  • Hi Daniel dm-p 

    Any chance you could take a look into this one (capabilities.json Data Roles), please? πŸ™

    Cheers
    Jan