Planning Analytics

 View Only
  • 1.  PAW UI API - Sending/Receiving messages

    Posted Wed April 17, 2024 10:37 AM

    Hi,

    I am using the Planning Analytics Workspace UI API to embed books and cube-viewers into a web frontend.

    I am able to show the PAW content but I have some questions on how to cummunicate with the embedded PAW content:

    1. Sending/receiving messages to or from a book

    Currently I am not able to communicate with an embedded book.

    The only message I receive is the 'onWidgetLoaded' message and I seems that I can not not subscribe to any message.

    The documentation says the following: If you want to control synchronization settings with the URL or JavaScript APIs, use the /ui parameter.

    I am using the /ui parameter and as far as I could see it in the UI APIs code, books only accept messages where the parameter eventName is sync.

    But when I post a message with the eventName set to sync the book only shows a toast message saying that the specification of the message is wrong.

    Is there an example how to communicate with books?

    It would be great if I could change the element selection for dimensions inside books, trigger a refresh and react to possible value inputs and element selections.

    2. Change the element selection of dimensions inside a cube-viewer

    I am able to communicate with embedded cube-viewers but I could not find out how to change the element selection for dimensions inside the cube-viewer.

    Is there a message that can be send to the cube-viewer to change the element/s for a specific dimension?

       Thank you very much



    ------------------------------
    Christoph Heinzen
    ------------------------------



  • 2.  RE: PAW UI API - Sending/Receiving messages

    Posted Wed April 17, 2024 06:03 PM

    Hi Christoph,

    Happy to help you with the synchronization aspect of your first question as I've recently come across it myself. Though it's called Synchronization, in my mind the use case is being able to create URLs to books with filtering all within the URL. 

    Below is an illustrative example of how it works.

    • I've added newlines for clarity, but this all a single line URL.
    • "book" corresponds to synchronization group names. Don't forget to turn on synchronization for widgets you'd like to control in this way.
    • You can add multiple synchronization groups and have more than two dimensions you're filtering on. 
    https://PlanningAnalyticsWorkspaceDomain/ui?type=book&path=/shared/Folder_Name/Book_Name#Synchronization=
    {"book":
    [
    	{"serverName":"TM1DBName","hierarchyID":"[dim1].[hier1]","memberSet":"{[dim1].[hier1].[ElementA]}"},
    	{"serverName":"TM1DBName","hierarchyID":"[dim2].[hier2]","memberSet":"{[dim2].[hier2].[ElementB]}"}
    ]
    }

    In this example, Book_Name is opened and all widgets that have "book" as the synchronization group, dim1 will be filtered on ElementA and dim2 will be filtered on ElementB.

    Hope this helps.



    ------------------------------
    Adam
    ------------------------------



  • 3.  RE: PAW UI API - Sending/Receiving messages

    Posted Thu April 18, 2024 04:55 AM
    Edited by Christoph Heinzen Thu April 18, 2024 08:59 AM

    Hi Adam,

    thank you very much!

    This is exactly the information I needed. The format you describe is also the format that has to be sent as eventPayload if you want to communicate with the embedded PAW book.

    I also found the following format when debugging the PAW UI API code:

        {
          "alias": "someAlias",
          "defaultMember": null,
          "hierarchyID": "[dim1].[hier1]",
          "isNamedSet": false,
          "memberID": "[dim1].[hier1].[ElementA]",
          "memberSet":"{[dim1].[hier1].[ElementA]}",
          "Private": false,
          "serverName": "TM1DBName"
        }

    This allowed me to change the alias used in the book, for example.

    The corresponding code for sending the message to the book is as follows (iFrame is the HTMLElement that embeds the book):

    iFrame.contentWindow.postMessage(
        { 
            'type': 'execute',
            'eventName': 'sync',
            'eventPayload': {
                'book': [
                    {
                        "alias": "someAlias",
                        "defaultMember": null,
                        "hierarchyID": "[dim1].[hier1]",
                        "isNamedSet": false,
                        "memberID": "[dim1].[hier1].[ElementA]",
                        "memberSet":"{[dim1].[hier1].[ElementA]}",
                        "Private": false,
                        "serverName": "TM1DBName"
                    }
                ]
            }
        }
    );



    ------------------------------
    Christoph Heinzen
    Virtivity GmbH
    Hamburg
    ------------------------------