cancel
Showing results for 
Search instead for 
Did you mean: 

Code example using Blox dropdown to select dashboards

jeffreyl
7 - Data Storage
7 - Data Storage

I have been searching the web for a couple of days with no success. I need a code example using Blox dropdown to select dashboards. I have 10 regional locations, each will have a set of dashboards. I am able to create and use 10 buttons on a dashboard but it would be cleaner and better if I can use a dropdown to open the url and go to the selected regional dashboard. I am thinking I need to use an Action Set but have not figured out how to make it work with a Blox dropdown or a radio button. I have found dropdown filter examples but have not been able to translate that to calling the action goto url.

1 ACCEPTED SOLUTION

harikm007
13 - Data Warehouse
13 - Data Warehouse

Hi @jeffreyl ,

Try this blox script:

1.  Create blox using below script (replace Dasboard1 URL and Dashboard2 URL with actual URLs):

 

 

{
    "style": {},
    "script": "",
    "title": "",
    "titleStyle": [
        {
            "display": ""
        }
    ],
    "showCarousel": true,
    "carouselAnimation": {
        "showButtons": false
    },
    "body": [
        {
            "type": "Container"
        },
        {
            "type": "ColumnSet",
            "separator": false,
            "spacing": "default",
            "columns": [
                {
                    "type": "Column",
                    "width": "170px",
                    "items": [
                        {
                            "type": "TextBlock",
                            "size": "small",
                            "weight": "regular",
                            "wrap": true,
                            "class": "checkboxVal",
                            "text": "Choose Dasbhoard"
                        }
                    ]
                },
                {
                    "type": "Column",
                    "spacing": "none",
                    "width": "175px",
                    "items": [
                        {
                            "type": "Container",
                            "spacing": "none",
                            "items": [
                                {
                                    "type": "Input.ChoiceSet",
                                    "id": "selectVal",
                                    "class": "",
                                    "displayType": "compact",
                                    "value": "",
                                    "choices": [
                                        {
                                            "title": "Dasboard1",
                                            "value": "Dasboard1 URL"
                                        },
                                        {
                                            "title": "Dashboard2",
                                            "value": "Dashboard2 URL"
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                },
                {
                    "type": "Column",
                    "spacing": "none",
                    "width": "175px",
                    "items": [
                        {
                            "type": "Container",
                            "spacing": "none",
                            "items": [
                                {
                                    "type": "ActionSet",
                                    "actions": [
                                        {
                                            "type": "openDashboardAction",
                                            "title": "Open"
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ],
    "actions": []
}

 

 

2. Create an action 'openDashboardAction' with below script:

 

 

dashboardURL = payload.data.selectVal
window.open(dashboardURL, '_blank').focus();

 

-Hari

 

View solution in original post

1 REPLY 1

harikm007
13 - Data Warehouse
13 - Data Warehouse

Hi @jeffreyl ,

Try this blox script:

1.  Create blox using below script (replace Dasboard1 URL and Dashboard2 URL with actual URLs):

 

 

{
    "style": {},
    "script": "",
    "title": "",
    "titleStyle": [
        {
            "display": ""
        }
    ],
    "showCarousel": true,
    "carouselAnimation": {
        "showButtons": false
    },
    "body": [
        {
            "type": "Container"
        },
        {
            "type": "ColumnSet",
            "separator": false,
            "spacing": "default",
            "columns": [
                {
                    "type": "Column",
                    "width": "170px",
                    "items": [
                        {
                            "type": "TextBlock",
                            "size": "small",
                            "weight": "regular",
                            "wrap": true,
                            "class": "checkboxVal",
                            "text": "Choose Dasbhoard"
                        }
                    ]
                },
                {
                    "type": "Column",
                    "spacing": "none",
                    "width": "175px",
                    "items": [
                        {
                            "type": "Container",
                            "spacing": "none",
                            "items": [
                                {
                                    "type": "Input.ChoiceSet",
                                    "id": "selectVal",
                                    "class": "",
                                    "displayType": "compact",
                                    "value": "",
                                    "choices": [
                                        {
                                            "title": "Dasboard1",
                                            "value": "Dasboard1 URL"
                                        },
                                        {
                                            "title": "Dashboard2",
                                            "value": "Dashboard2 URL"
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                },
                {
                    "type": "Column",
                    "spacing": "none",
                    "width": "175px",
                    "items": [
                        {
                            "type": "Container",
                            "spacing": "none",
                            "items": [
                                {
                                    "type": "ActionSet",
                                    "actions": [
                                        {
                                            "type": "openDashboardAction",
                                            "title": "Open"
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ],
    "actions": []
}

 

 

2. Create an action 'openDashboardAction' with below script:

 

 

dashboardURL = payload.data.selectVal
window.open(dashboardURL, '_blank').focus();

 

-Hari