Cognos Analytics

 View Only
  • 1.  RE : Running Dashboard using Javascript API (ca-dashboard-js-api) with Customised Extension

    Posted Thu October 06, 2022 01:43 AM
    Hello All , 

    We are trying to capture the Dashboard Filter values and Modify the values and run the dashboard using the Customized Extension . 
    As we have both Global Filters and This Tab Filters are available in a dashboard  , we are able to read and modify the Global Filters values using available Dashboard Class objects (ca-dashboard-js-api). Here is the sample code .

                 var Gfilters = __getDashboardAPI().getFeature('GlobalFilters').getFilters();
                  Gfilters.editFilter({
                              itemId: ColumnId
                                }, {
                       values: [array]
                 });
     
    Is there any class objects available to read and edit(modify programmatically)  the "This Tab" Filter values using JavaScript Dashboard API ? If anybody has  already using this feature please share the implementation details.

    ------------------------------
    Anitha Royal
    ------------------------------

    #CognosAnalyticswithWatson


  • 2.  RE: RE : Running Dashboard using Javascript API (ca-dashboard-js-api) with Customised Extension

    IBM Champion
    Posted Fri October 07, 2022 08:07 AM
    The only place I've seen to access tab filters is through here:

    var pcs = __getDashboardAPI().getFeature('PageContextService')
      , items = pcs.getPageContext().getPageContextItems()

    The items array has the tab filters. Use item[x].getScope() to match to a specific tab. 


    ------------------------------
    Paul Mendelson
    ------------------------------



  • 3.  RE: RE : Running Dashboard using Javascript API (ca-dashboard-js-api) with Customised Extension

    Posted Mon October 10, 2022 06:57 AM
    Hello Paul , 

    Thank you for your response , with this class object we can just get the values of tab filters(saved values) but was looking to modify(edit) the Tab filter values using API same like Global Filters

    ------------------------------
    Anitha Royal
    ------------------------------



  • 4.  RE: RE : Running Dashboard using Javascript API (ca-dashboard-js-api) with Customised Extension

    IBM Champion
    Posted Wed October 12, 2022 07:31 AM
    Hi Anitha,

    Check the 
     pcs.getPageContext().updateFilterContext function


    This sets the filter on 2011:
    pcs.getPageContext().updateFilterContext(
    {
    "sourceId": "model00000183c8404a03_00000002",
    "itemId": "page_7.Year_",
    "itemName": "Year",
    "dataType": "integer",
    "isHierarchy": false,
    "isNamedSet": false,
    "scope": "model00000183c83ff8df_00000002",
    "eventSourceId": "NonNumericFilterController9"
    }
    , {
    "command": "replace",
    "values": {
    "page_7.Year_->[2011]": {
    "u": "page_7.Year_->[2011]",
    "d": 2011,
    "value": "page_7.Year_->[2011]",
    "label": 2011,
    "selected": true
    }
    },
    "exclude": false
    })

    ------------------------------
    Paul Mendelson
    ------------------------------



  • 5.  RE: RE : Running Dashboard using Javascript API (ca-dashboard-js-api) with Customised Extension

    Posted Thu October 13, 2022 09:48 AM
    Hello Paul , 

    Thank you so much for sharing this updateFilterContext method , Its working as expected.
    Can you please share the method definition details document you referred (if any) to format the object(structure) with all specified properties and respective values which has to passed as a parameters to Page context Methods available.


    ------------------------------
    Anitha Royal
    ------------------------------



  • 6.  RE: RE : Running Dashboard using Javascript API (ca-dashboard-js-api) with Customised Extension

    IBM Champion
    Posted Tue October 18, 2022 07:13 AM
    Unfortunately I don't have any documentation. What I do is use the browser debugger and trace the activity. It takes a while, but you can usually get a good idea of how it works.

    ------------------------------
    Paul Mendelson
    ------------------------------