IBM Business Analytics

 View Only
Expand all | Collapse all

Cognos Java Script API to find search path of an object

  • 1.  Cognos Java Script API to find search path of an object

    Posted Thu February 22, 2024 03:35 AM

    Dear guys,

    I have been investigating the sample code in IBM docs about creating a custom action controller.

    Creating a custom action controller

    in the javascript file I saw: 

    this.execute = function(context, target) { var info = 'This sample menu item extension opens an alert. \nThe alert contains information about the selected report. \n\nType: ' + target.options[0].type + '\nName: ' + target.options[0].name + '\nID: ' + target.options[0].id;

    As far as I understand we can reach "Type" of the object, "name" of the object and "id" of the object.

    Does anyone know how to access the searchpath of the object?

    Thabks and regards


    Ibm remove preview
    Creating a custom action controller
    You can create custom action controllers to perform actions that are not available with the built-in action controllers. Custom action controllers are written in JavaScript using the Asynchronous module definition (AMD) API.
    View this on Ibm >

    Sukru Haciyanli

  • 2.  RE: Cognos Java Script API to find search path of an object

    IBM Champion
    Posted Fri February 23, 2024 08:51 AM
    Edited by Jim Boland Fri February 23, 2024 08:53 AM

    Hi Sukru,

    There are several APIs you can use to send a request to get back the searchPath respective of a given storeID, but you might be able to do something even simpler.

    You can "create" a valid searchPath to pass in pretty much anywhere you use a searchPath, from the storeID by using this as the "searchPath":


    (replacing <id> with your storeID). Depending on the context of where you are using this, you may need to encode the quotes - e.g.


    For example you can view a report with the following:


    (You can read more about this here: )

    If you decide you really do want to make a separate API call to get the searchPath back from the storeID, here is a sample REST GET request to accomplish this:


    (replacing <servername> and <storeID> with your values).

    I haven't tried, but I think you can do something similar with the public REST API's "content" endpoint.

    Jim Boland