Switchable Dimensions

Comments

51 comments

  • Avatar
    Oleg Fil

    Denis, Adi,

    We've recently updated the plugin, could you please verify on your end the issue still exists?

    0
    Comment actions Permalink
  • Avatar
    Glenn Hinkley

    I'm having some difficulty getting this plugin to run at all.  I suspect it has to do with one of the following:

    --Can you sort on a saved formula?  I'm looking to switch between a calculated Gross Margin (SUM([Extended Price]-[Extended Cost])) and the Total Extended Price (SUM([Extended Price]).  I can type "gross" into the data browser and the formula appears, but it's not in a table in the Elasticube.

    --What additional formatting is required to use table and column names that contain spaces?  I know it's bad practice, I don't have a choice though.

    I downloaded one of the example dashboards from the comments, and the switch works there, so I know the plugin does work.

    My code as it stands: (variables renamed)

    prism.registerSwitchDimension({
       widget: widget,
       dimensions: [
          {
              "index": 0,
              "panel": "values",
              "dim": "[[Table with spaces].Extended Price]",
              "title": "Total Extended Price"
              "widgetTitle": "Top Products by Extended Price"
          },
          {
              "index": 0,
              "panel": "values",
              "dim": "[Gross Margin]",
              "title": "Gross Margin"
              "widgetTitle": "Top Products by Gross Margin"
          }
       ]
    });


    I'm new to Sisense, Plugins, and JAQL, so any assistance is appreciated

    0
    Comment actions Permalink
  • Avatar
    Oleg Fil

    Hi Glenn,

    If a table contains spaces in its name the format of the dimension remains the same: "[Table With Spaces.Column]"

    Unfortunately the plugin doesn't support formulas instead it supports only aggregation functions and the format for values should be defined like this:

    {
        panel: 'values',
        dims: [
          {
            'index': 0,
            'dim': '[Commerce.Cost]',
            'datatype': 'numeric',
            'agg': 'sum',
            'title': 'Total Cost'
          },
          {
            'index': 0,
            'dim': '[Commerce.Revenue]',
            'datatype': 'numeric',
            'agg': 'sum',
            'title': 'Total Revenue'
          }
        ]
    }

    0
    Comment actions Permalink
  • Avatar
    Adi Hecht

    @Oleg Fil,

    You mentioned you updated the plugin recently, can you say when was the last update?

    0
    Comment actions Permalink
  • Avatar
    Oleg Fil

    Hi Adi,

    You may find the update history at the bottom of the post. The latest one was on January 3 2018.

    0
    Comment actions Permalink
  • Avatar
    Glenn Hinkley

     

    Thanks, Oleg!  It would also help if I put all the necessary commas in...

    I can switch dimensions now, and I'll just add the calculated column to the Elasticube and aggregate from that.

    0
    Comment actions Permalink
  • Avatar
    Alexandros Antoniou

    This plugin stopped working for me and I do't know why.

    prism.registerSwitchDimension({
       widget: widget,
       dimensions: [
          {
          panel: 'rows',
          dims: [
              {
    "index": 0,
    "dim":"[Product_dim.Category]",
    "datatype": "text",
    "title": "", //optional
    "widgetTitleTemplate": "" //optional
    }
    ,{
    "index": 0,
    "dim":"[Product_dim.Manufacturer]",
    "datatype": "text",
    "title": "", //optional
    "widgetTitleTemplate": "" //optional
    }
    ]
    }
    ]
    });


    Does anybody understand what I am doing wrong?
    Also I don't get where I should use "" panel: 'rows', """. Is it in each dim or just outside like I did above?

    I am using Sisense version 6.7.1.15016

    0
    Comment actions Permalink
  • Avatar
    Oleg Fil

    Hi Alexandros,

    The config you provided looks correct.

    Which type of widget you're trying to set up to be switchable?

    0
    Comment actions Permalink
  • Avatar
    Alexandros Antoniou

    Hi Oleg,

    It's a pivot table.

     

    0
    Comment actions Permalink
  • Avatar
    Oleg Fil

    Alexandros,

    I verified the plugin with your config and it worked for me. Please make sure you saved the widget script and that table name "Product_dim" and columns "Manufacturer" and "Category" are valid. Pay attention that table and column names are case sensitive.

    0
    Comment actions Permalink
  • Avatar
    Danilo Soto (Edited )

    Hi Oleg. The SwitchDimension plugin stopped working for v7.1.0.10324, have you experienced the same issue? It was working perfectly on v7.0.2.11001

    Our code typically looks like this:

    prism.registerSwitchDimension({
    widget: widget,
    maxItemsBeforeSubMenuIsCreated: 4,
    dimensions: [
    {

    panel: 'point',
    affectAllWidgets: true,
    dims: [
    {
    "index":0,
    "dim":"[dim_estructura.subcategoria]",
    "datatype": "text",
    "title":"Subcategoría",
    "widgetTitleTemplate":"Matriz Venta Neta s/IVA vs Precio c/IVA"

    },

    {
    "index":0,
    "dim":"[fact_comercial_dia.marca]",
    "datatype": "text",
    "title":"Marca",
    "widgetTitleTemplate":"Matriz Venta Neta s/IVA vs Precio c/IVA"
    }
    ]
    }
    ]

    });

    0
    Comment actions Permalink
  • Avatar
    Danilo Soto

    UPDATE: if you are experiencing the same problem when moving to v7.1.0.x, here is the procedure that fixed it, thanks to Oleksii who helped us in the process:

    This issue is affected by function isNeededToCreateSubMenu(). To fix this issue, please, apply next steps:

    • Open file switchDimension.js which is located at the path C:\Program Files\Sisense\PrismWeb\plugins\SwitchDimension;
    • Find next function:
    function isNeededToCreateSubMenu(dimensionsSettings, allowedLength) {
      var dimCount = 0;
      for (var key in dimensionsSettings) {
        dimCount += dimensionsSettings[key].dims.length;
      }
      return dimCount >= allowedLength;
    }
    • Add additional verification to this function:
    function isNeededToCreateSubMenu(dimensionsSettings, allowedLength) {
      var dimCount = 0;
      for (var key in dimensionsSettings) {
        if (dimensionsSettings[key].dims) {
          dimCount += dimensionsSettings[key].dims.length;
        };
      } 
      return dimCount >= allowedLength;
    }

    Make sure that these changes were applied. The best approach to apply these changes, please, disable and enable this plugin.

    0
    Comment actions Permalink
  • Avatar
    Delsaran Bigglesworth

    This isn't working for me. I have all the code right and it gives me the option to switch the dimensions. When I click to change the category, the X axis (which is a date) become really funky and displays some random dates in the first few columns and then random series for the rest. Anyone have any idea why this is happening?Before I click:

    After click:

     

    0
    Comment actions Permalink
  • Avatar
    Jim Thomas

    I have a different Drill Hierarchy for each dimension that is switched, but when I apply them, they are only saved on one dimension, not each one.  When I go back and review them the Hierarchy is no longer checked in the editor.  Is this a bug in v7.2 or is there something else going on?  See attached screen shot.

    0
    Comment actions Permalink
  • Avatar
    Alina Lotman

    Hi,

    I have a table that has a dot in it's name and it is breaking the plugin - Is there a way to wrap that dot?

    The name of the table is: Db_Warehouse.Reports_Recommendation_All_Clients

    The name of the column is: OverallRecommendationTitleNew

    See syntax below:

    {
    panel: 'break by',
    affectAllWidgets: true,
    dims: [
    {
    "index":0,
    "dim":"[Db_Warehouse.Reports_Recommendation_All_Clients.OverallRecommendationTitleNew]",
    "datatype": "text",
    "title":"Overall Recommendation Level"
    //"widgetTitle":"Distribution of Recommendation Level by Job Profile"
    },
    {
    "index": 0,
    "dim":"[Db_Warehouse.Reports_Recommendation_All_Clients.RecTitle]",
    "datatype": "text",
    "title":"Recommendation Level"
    //"widgetTitle":"Distribution of Recommendation Level by Job Profile"
    }
    ]
    }

     

    Thanks in advance!

    0
    Comment actions Permalink
  • Avatar
    David Rogers

    While this says it is supported by Sisense, it is not listed on https://documentation.sisense.com/latest/sisense-mobile.htm as being supported on the app.  From our vantage point, if it's not supported on the app, it's not supported.

    Thanks.

    0
    Comment actions Permalink
  • Avatar
    Dhrubajyoti Das

    I have two widgets in the dashboard and I want to keep the title of the widgets intact. It means the titles should not change as I switch between dimension/measures/break by. Where should I make the changes in the script?

     

    1
    Comment actions Permalink
  • Avatar
    David Rogers

    I have this same issue.  I don't want my widget titles to change.  I commented the line in the script out, but that didn't make any difference.  Suggestions, please?

    0
    Comment actions Permalink
  • Avatar
    David Rogers

    Answering my own question...go into the switchDimension.6.js file and comment out two lines:

    dashboardWidget.title = aliasService.alias('widgets', widgetTitle);

    widget.title = aliasService.alias('widgets', widgetTitle);

    0
    Comment actions Permalink
  • Avatar
    Raphael Shejnberg (Edited )

    I'm able to get things working but only using the 'values' panel. When specifying 'categories' or 'break by' the option doesn't show up when right clicking the chart. Any ideas on what I could be doing wrong? 

    {
    panel: 'categories',
    affectAllWidgets: false, //optional (true|false)
    dims: [
    {
    "index":0,
    "dim":"[users.created_at]",
    "datatype":"datetime",
    "title":"Created At",
    "widgetTitle": "Users Over Created At"
    },
    {
    "index":0,
    "dim":"[users.updated_at]",
    "datatype":"datetime",
    "title":"Updated At",
    "widgetTitle": "Users Over Updated At"
    }
    ]
    }

    0
    Comment actions Permalink
  • Avatar
    Teh Wenhui

    Can it be used to switch a date dimension between year, month, week and day?

    0
    Comment actions Permalink

Please sign in to leave a comment.