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

    Sukru

    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":

    storeID("<id>")

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

    storeID(%22<id>%22)

    For example you can view a report with the following:

    http://servername/cognos10/cgi-bin/cognos.cgi?b_action=cognosViewer&ui.action=run&ui.object=storeID(%22storeIDhere%22)

    (You can read more about this here: https://www.cognoise.com/index.php?topic=29263.0 )

    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:

    http://<server>:9300/bi/v1/objects/<storeid>?fields=searchPath&target.searchPath

    (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

    LinkedIn: https://www.linkedin.com/in/jimboland
    Website: https://coreinsightz.com
    Email: jimboland@coreinsightz.com
    ------------------------------