cancel
Showing results for 
Search instead for 
Did you mean: 

looking to create a custom Dashboard filter from a result from another widget (Live Data Model)

ssoltz
8 - Cloud Apps
8 - Cloud Apps

Dear Sisense Community,

I am looking to see if there is a way through scripting that I can use the values from a Pivot table (one column of text data) to create a custom (Advanced) filter for the Dashboard.

By the way, although I'm capable with the Sisense interface (Dashboards, Widgets, formulas, etc.), I am not a coder whatsoever.

Please see the link for details:

https://vimeo.com/909839916?share=copy

Thank you in advance!

1 ACCEPTED SOLUTION

rapidbisupport
11 - Data Pipeline
11 - Data Pipeline

Hi @ssoltz ,

You could achieve this with a BloX rendering a button and a dashboard script that:

  • gets the results from the target pivot table (specified by target widget oid)
  • uses those results to add members to a filter (specified by target filter title)
  • and then refreshes the dashboard to view the new results.

Please note that the solution below will only work with pivot result sets acting as filter members. It could be adapted for different source results - but won't work OOTB.

BloX Script:

 

{
    "style": "",
    "script": "",
    "title": "",
    "showCarousel": true,
    "body": [
        {
            "type": "TextBlock",
            "id": "",
            "class": "",
            "text": "<button id='filterButton'>Set Filter</button>"
        }
    ],
    "actions": []
}

 

Dashboard Script (change the result widget oid to the pivot table oid and target filter title to the title of the filter you want to change):

 

const targetWidgetWithResultOid = '65c2d47b874ecd0042b02068'
const targetFilterTitle = 'CountryName'

dashboard.on('domready', () => {
    $('#filterButton').on('click', () => {
        const targetWidgetWithResult = prism.activeDashboard.widgets.$$widgets.find((w) => { return w.oid === targetWidgetWithResultOid })
        const targetWidgetResponse = targetWidgetWithResult.queryResult.loadService.data.data[0].data.map((r) => { return r.value })
        const targetFilter = prism.activeDashboard.filters.flatten().find((f) => { return f.jaql.title === targetFilterTitle })
	delete targetFilter.jaql.filter.all
        targetFilter.jaql.filter.members = targetWidgetResponse
        prism.activeDashboard.refresh()
    })
})

 

 Let me know how you go?

Thanks,

Daniel

RAPID BI

[email protected]

RAPID BI - Sisense Professional Services | Implementations | Custom Add-ons

 

View solution in original post

4 REPLIES 4

rapidbisupport
11 - Data Pipeline
11 - Data Pipeline

Hi @ssoltz ,

You could achieve this with a BloX rendering a button and a dashboard script that:

  • gets the results from the target pivot table (specified by target widget oid)
  • uses those results to add members to a filter (specified by target filter title)
  • and then refreshes the dashboard to view the new results.

Please note that the solution below will only work with pivot result sets acting as filter members. It could be adapted for different source results - but won't work OOTB.

BloX Script:

 

{
    "style": "",
    "script": "",
    "title": "",
    "showCarousel": true,
    "body": [
        {
            "type": "TextBlock",
            "id": "",
            "class": "",
            "text": "<button id='filterButton'>Set Filter</button>"
        }
    ],
    "actions": []
}

 

Dashboard Script (change the result widget oid to the pivot table oid and target filter title to the title of the filter you want to change):

 

const targetWidgetWithResultOid = '65c2d47b874ecd0042b02068'
const targetFilterTitle = 'CountryName'

dashboard.on('domready', () => {
    $('#filterButton').on('click', () => {
        const targetWidgetWithResult = prism.activeDashboard.widgets.$$widgets.find((w) => { return w.oid === targetWidgetWithResultOid })
        const targetWidgetResponse = targetWidgetWithResult.queryResult.loadService.data.data[0].data.map((r) => { return r.value })
        const targetFilter = prism.activeDashboard.filters.flatten().find((f) => { return f.jaql.title === targetFilterTitle })
	delete targetFilter.jaql.filter.all
        targetFilter.jaql.filter.members = targetWidgetResponse
        prism.activeDashboard.refresh()
    })
})

 

 Let me know how you go?

Thanks,

Daniel

RAPID BI

[email protected]

RAPID BI - Sisense Professional Services | Implementations | Custom Add-ons

 

ssoltz
8 - Cloud Apps
8 - Cloud Apps

So, I can't express how much this solution has helped me. This is huge! I cannot thank you enough. Once I figured out how to get the widget OID, it pretty much worked OOTB. Perfect solution...

I cannot thank you enough!

ssoltz
8 - Cloud Apps
8 - Cloud Apps

Daniel...thank you!

rapidbisupport
11 - Data Pipeline
11 - Data Pipeline

You're very welcome! Happy to help!

Thanks,

Daniel

RAPID BI

[email protected]

RAPID BI - Sisense Professional Services | Implementations | Custom Add-ons