Facility Control

 View Only
  • 1.  Button label by Parameter

    Posted 05-28-2015 22:19
    Hi all,

    I'm working on a Dashboard custom panel for XPression, and I have parameters setup for the Home & Visiting team name and would like the buttons for Home & Vis score to say their names (e.g. instead of Home Score +1, it'll say "Durham Score +1"). Does anyone have any ideas on how to accomplish this, or if its even possible?

    Thanks for you help,

    Rob


  • 2.  RE: Button label by Parameter

    Posted 05-29-2015 18:35
    Hi Rob,

    Yes, you need to give your buttons an 'ID'. This should not be confused with the button name.

    The button name is what appears in the UI, the button ID is how you reference it through script. (The ID is right below the name in the editor when you double click on the button in edit mode).

    There is a script function that allows you to rename any item in the UI by it's ID.

    ogscript.rename('ID','new name');

    If you have a parameter you need to get it's value and then modify it, so you script might look something like:

    var name = params.getValue('home_team_name', 0);

    ogscript.rename('to_change',name + ' + 1');

    *pay attention in the above example to which items have quotes around them and which don't. An exact quote will use that string exactly as shown, items without quotes are variable names. *

    The simplest thing to do is attach that script to your parameter on screen, so, whenever that parameter changes, it will run the above script to rename that button.

    You may also want to put that script as an 'onLoad' script so that when you open your panel it automatically updates the names of the buttons as well.

    To do that, in Edit mode in the upper left you will see a bunch of buttons below the words 'Insert Tab', choose the one that says 'ogscript', in that editor, there is now a dropdown called 'Event Type(s)', select that and pick 'onLoad'. Now any scripting you put here gets run when the Custom Panel is opened.

    Let me know if you have any issues.

    Troy.

    #DashBoard


  • 3.  RE: Button label by Parameter

    Posted 05-29-2015 19:36
    Hi Troy,

    Thank you for your quick response - that works perfectly!

    Rob

    #DashBoard