Page 1 of 1

Making TM1Web Behave (For TM1Web API)

Posted: Tue Jan 26, 2010 11:01 pm
by Kyro
I'm not sure many people would want to do this but...

Within TM1 Web we can utilise the TM1 Web API which is a URL API. This allows us to make hyperlinks(anchors) which open web reports or cube views that we choose (instead of relying on Action Buttons or the Navigation Panel). The problem with this presently is that all hyperlinks (in TM1web) open in a new window which may break the whole "Seemless Integration" Bubble we would like clients to experience.

I've written a little mod/hack for TM1Web that applies smart logic to the Hyperlink process. Using this mod TM1Web will look at the URL and if it includes TM1Web in there somewhere it will open in the active window instead of in a popup.

Decent uses of this mod:
  • Making Drillable Accounts/Costcentres in an Active Form.
    The use of the Hyperlink excel function. (allows for conditional logic determining which webreport to load next) - workaround with action buttons is available
    Normal Navigation between workbooks (and passing parameters) - can do with action buttons
Anyway, if you deem it worth it here is the mod:

Within the /TM1Web/Scripts Internet Directory open "tm1webbook.js" (This is usually in C:\inetpub\wwwroot\ )
Replace the code:

Code: Select all

    case 'Link':
           unSelectEverything();
           SetSheetCurrentCell(srcElem.parentNode);
           if ( srcElem.getAttribute('LinkType') == 'LINK_EXTERNAL' ) {
                  cancelEventBubble(e);
                  window.open(srcElem.getAttribute('refValue'), '_new');

           }
           else {
                  var cellID = delem[1] + "_" + delem[2] + '_' + delem[3];
                  SubmitForm(delem[0], cellID);
           }
           break;

With the code:

Code: Select all

            case 'Link':
                     unSelectEverything();
                     SetSheetCurrentCell(srcElem.parentNode);
                     if ( srcElem.getAttribute('LinkType') == 'LINK_EXTERNAL' ) {

                            cancelEventBubble(e);

                            //Get the hyperlink location for searching
                            var slocation = srcElem.getAttribute('refValue');

                            //Look for "TM1Web" in it
                            if( slocation.indexOf("tm1webmain") > 0)
                            {
                                   //Set the location of the current window instead of opening a new.
                                   window.location = srcElem.getAttribute('refValue');
                            } else {
                                   //Open a new window as per usual
                                   window.open(srcElem.getAttribute('refValue'), '_new');
                            }

                     }
                     else {
                            var cellID = delem[1] + "_" + delem[2] + '_' + delem[3];
                            SubmitForm(delem[0], cellID);
                     }
                     break;
The changes may not take effect until you close your browser and then delete your browser's temporary internet files, (especially on Internet Explorer) as they cache javascript files.

Re: Making TM1Web Behave (For TM1Web API)

Posted: Wed Jan 27, 2010 12:08 am
by Ivan Cepero
Whoa! Nice! I can't wait to try this out!

Re: Making TM1Web Behave (For TM1Web API)

Posted: Thu Jul 05, 2012 3:34 am
by hiraniha
I appreciate this is an old post, but actually addresses exactly what I want to do, however I can't get this to work.

I have a Menu page and I have created two hyperlinks using the api syntax, one to a cubeview and another to a websheet.

If I click on the menu page another webpage window is opened, in my case a new IE tab.

I want thos to be just another tm1 tab within the same window, as it does when you navigate via the tree.

I have even tried renaming the file you refer to, it seems to make no difference to the link opening.

I'm using both 9.5.2. and 10.1.0 and the symptons are exactly the same.