Cognos Analytics

 View Only
  • 1.  Dashboard - Hide Filters pane by default

    Posted Mon May 13, 2024 12:12 PM

    Is there a way of hiding the filter pane in dashboards so it shows a collapsed view when the user opens the dashboard up???



    ------------------------------
    Eric Mueller
    ------------------------------


  • 2.  RE: Dashboard - Hide Filters pane by default

    Posted Mon May 20, 2024 04:34 PM
      |   view attached

    Not out of the box. If you have a filter applied as a default setting it will always show the filter bar on open. I created a Cognos extension that checks for the loading of widgets on the page and closes the filter bar once the page is loaded. Use the widgetID and add it to the Widget ID's box. You can decrease the opacity or push the z index to be behind all visible widgets to hide it. I have tested it only with 11.2.4 and 12. Not certain if it will work with 11.7. 

    I needed this function so that I could make the default filters come from a report which embedded my dashboard and passed the filters to the dashboard. It was a pretty crazy hack to use report filters for a dashboard and I needed to hide the dashboard filters to make it easier for users to know where to change filters. I hope this is helpful for you!



    ------------------------------
    Michael Webb
    ------------------------------

    Attachment(s)

    zip
    DashboardReady.zip   1.00 MB 1 version


  • 3.  RE: Dashboard - Hide Filters pane by default

    Posted Tue May 21, 2024 11:20 AM

    Hi Michael, 

    How did you manage this? 

    "...default filters come from a report which embedded my dashboard and passed the filters to the dashboard." 

    I'm not aware of a way to pass filters from a report to a dashboard but I would like to know. 

    Best regards, 

    Philipp 



    ------------------------------
    Philipp Hornung
    Business Intelligence Manager
    Techniker Krankenkasse
    Hamburg Germany
    #IBMChampion
    ------------------------------



  • 4.  RE: Dashboard - Hide Filters pane by default

    Posted Tue May 21, 2024 12:34 PM
    Edited by Michael Webb Tue May 21, 2024 12:46 PM

    Hi Philipp,

    My method is a little convoluted and specific to my use case. Our data warehouse has a fuzzy lookup of multiple columns for organization parameters so my mappings required validating multiple columns against each other so it's hard to give you a lot of details without getting confusing so I will tell you my steps and then generalize it for you. Also it doesn't work if you select too many parameters but this is how I did it. 

    I created a report page with a prompt and a list that gets filtered by the prompt and I added an several HTML items on the page. the HTML items held a couple spans with information from the query the prompt generates, and an empty iframe which we render the dashboard inside. 

    I then created a custom control called DashURL which uses the dashprompt.js in the file I shared. This custom control scrapes the prompt api to get all prompt key value pairs and then maps them to a new object structure. My use case required validating the prompt output with the values returned in the list because my data sources for the prompt and the dashboard were different so all the prefixes and column names needed to be mapped out. 

    This object structure is the same one that dashboards use to drill through to another dashboard and then it gets appended to the url. The problem is the url length can max out pretty easily so its best used if you don't need to select many values in a single prompt. I want to note, that this object structure is also verbose. 

    The way the object structure works is you need to define a scope (page, widget) through getting the widgetId or the highest level widgetid in the report specification for the dashboard. You need to be able to have the name of the column you want to filter, operator which is the ( in, and, or) for the filter, and the filter values which is an object of display and value. Then you make an array of all the filters you want to apply and place them in an object formed like the one below:

    {
      options: {
        overrideExistingFiltersOnly: true/false,
        matchMetadataAcrossSources: true/false,
      },
      filters: [
        {
          scope: widgetId,
          columnId: columnName,
          operator: "in",
          values: {
            u: "displayValue -> [valueValue]",
            d: "valueValue"
          }
        }
      ],
    }

    I then encodedURI this object and added it to the dashboard url like this:
    .../bi/?perspective=dashboard&pathRef=...&closeWindowOnLastView=true&ui_appbar=false&ui_navbar=false&shareMode=embedded&action=view&mode=dashboard&filters=${encodedFilterObject}
    Then I take this new url and add it as the src for the iframe in the html item we placed on the page.

    Now at the time this method had some drawbacks. I believe it is changed now in 12.0.3 but in previous versions we had an issue in reports where search and select prompts would rerender the page when you ran the search query. This would cause the dashboard to also rerender and was cause for slow performance and extra fetch requests for the dashboard on each render. Also if you selected too many filter selections it would max our the URL length and the dashboard wouldn't grab all the filters or any of them. 

    My future solution is to create a similar method using the cross window context api for dashboards and have prompts pass the values to the dashboard that way. I think that is the best possible way to use report prompts to manage the dashboard filters. Since the newer prompts now can run without rerendering the page it should make it much easier to implement. 

    Hope that helps!

    p.s. I also want to use the custom control datastore instead of lists for future versions to make the logic less complicated. 




    ------------------------------
    Michael Webb
    ------------------------------



  • 5.  RE: Dashboard - Hide Filters pane by default
    Best Answer

    Posted Tue May 21, 2024 01:42 PM
      |   view attached

    I made a simple dashboard and got a sample of what a simple url could look like. This is using the American Time Use dataset and just a single filter on age range. I included the dashboard specifications for you as well. You can copy and paste them in a new dashboard and then play with the url filter parameters.

    &filters=%5B%7B%22id%22%3A%22M1_American_time_use_xlsx.Age_Range%22%2C%22columnId%22%3A%22M1_American_time_use_xlsx.Age_Range%22%2C%22values%22%3A%5B%7B%22d%22%3A%2220-29%22%2C%22u%22%3A%2220-29%22%7D%2C%7B%22d%22%3A%2230-39%22%2C%22u%22%3A%2230-39%22%7D%2C%7B%22d%22%3A%2240-49%22%2C%22u%22%3A%2240-49%22%7D%2C%7B%22d%22%3A%2250-59%22%2C%22u%22%3A%2250-59%22%7D%2C%7B%22d%22%3A%2260-69%22%2C%22u%22%3A%2260-69%22%7D%2C%7B%22d%22%3A%2270-79%22%2C%22u%22%3A%2270-79%22%7D%2C%7B%22d%22%3A%2280%2B%22%2C%22u%22%3A%2280%2B%22%7D%2C%7B%22d%22%3A%220-19%22%2C%22u%22%3A%220-19%22%7D%5D%2C%22excludedValues%22%3A%5B%5D%2C%22operator%22%3A%22in%22%2C%22type%22%3Anull%2C%22assetId%22%3A%22i72F95B15ADD44CC29FA27028BE28D0DD%22%2C%22scope%22%3A%22global%22%7D%5D

    &
    filters = [{
        "id": "M1_American_time_use_xlsx.Age_Range",
        "columnId": "M1_American_time_use_xlsx.Age_Range",
        "values": [{
            "d": "20-29",
            "u": "20-29"
        }, {
            "d": "30-39",
            "u": "30-39"
        }, {
            "d": "40-49",
            "u": "40-49"
        }, {
            "d": "50-59",
            "u": "50-59"
        }, {
            "d": "60-69",
            "u": "60-69"
        }, {
            "d": "70-79",
            "u": "70-79"
        }, {
            "d": "80+",
            "u": "80+"
        }, {
            "d": "0-19",
            "u": "0-19"
        }],
        "excludedValues": [],
        "operator": "in",
        "type": null,
        ,
        "scope": "global"
    }]



    ------------------------------
    Michael Webb
    ------------------------------

    Attachment(s)

    json
    dashboardspec.json   39 KB 1 version


  • 6.  RE: Dashboard - Hide Filters pane by default

    Posted Thu May 23, 2024 02:35 AM

    Hi Eric, 

    Thanks for sharing your approach, I got got some really interesting ideas from it. Actually I wasn't aware that the key word filters is also supported for dashboard URLs. Hopefully IBM will make more out of it (like dashboard views or drillt-hroughs from report to dashboard).

    Best regards,

    Philipp



    ------------------------------
    Philipp Hornung
    Business Intelligence Manager
    Techniker Krankenkasse
    Hamburg Germany
    #IBMChampion
    ------------------------------