Skip to Content
Technical Articles
Author's profile photo James Lim

SAC Analytics Designer – Dynamic Menu based on user id.

I made a simple prototype because a customer wants this feature.

Basically, Users don’t want to see all menus (or links) because they never uses or not allowed to use those menu items so if we can hide/show menus based on user id, that will make simple UI/UX for end users.


Here is a screenshot of my prototype.

As you can see, there are four menus(Text widget) and one dropdown box.

When user is selected in the dropdown, then menu will be shown/hidden based on what he is allowed.

Those information is saved in a separate model and it should have user name from Empolyee dimension and menu dimension as in the table.


When user is selected,  Menu will be shown based on the definition in the model.

Menu1, Menu 3 and Menu 4 has value 1 so it is shown.



Here is the code of dropdown onclick event.


var strid = Dropdown_1.getSelectedKey();

if (strid === “0”) {

else {
       // Table Filter setting.

       //Note: if the dimension has hierarchy, you should specify the hierarchy name with       

        member id for filtering.

strid = “[EMPLOYEE].[HIERARCHY1].&[” + strid + “]”;

// get the table value and number of column for counting the number of menu
var col_count = Table_1.getColumnCount();
var data_set = Table_1.getDataSource().getResultSet();
var menu_flag = “”;

// call a function to show or hide the menu.
for (var i=0; i < col_count; i++){
menu_flag = data_set[i][“@MeasureDimension”].rawValue;
      ScriptObject_1.setmenu(i, menu_flag);


Here is the code of setmenu in the ScriptObject_1. it just get the text Widget from the arr_text array.

function setmenu(arg1: integer, arg2: string) : void

if (arg2 === “1”) {


Then we need to put Text Widgets into the arr_text array.

it should be done in the canvas onInitialization() event.




The arr_text should be defined as Scripting variable.


Instead of using dropdown box, we can get the current user id in Analytics Designer app so we can  use it when the application is initializing.

It could be tricky to maintain users and menus but it will be one time maintenance task and can be done by functional team instead of technical team. Therefore, I believe it can be a good option to do.

It is a prototype so if anyone has better idea, please leave a comment 🙂






Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Jef Baeyens
      Jef Baeyens

      Hi James,

      Very common requirement I would say. Is there any way we can base this on the current user's team membership?

      Author's profile photo James Lim
      James Lim
      Blog Post Author

      Hi Jef,

      Then we may need additional information for team and user relationship.

      For example, the model should have team dimension and it should have user relationship.

      Based on my experience, user can be a member of multiple team so it can be Union.


      I knew that requirement but for the prototyping, I just want to show the idea how we can achieve it.

      If the customer may accept this concept and agree to provide some staffing time for me, then I can develop it.  🙂

      Author's profile photo James Lim
      James Lim
      Blog Post Author
      To get the current user id, please use below script in the Analytics Designer.
      var user = Application.getUserInfo().id;