Facility Control

 View Only
  • 1.  dynamic target status

    Posted 08-13-2025 15:20

    hi,

    I was working on the following code to dynamically track ultrix and panel updates for destination sources. However, the destination index is stuck at a fixed value. I couldn't detect any changes. Could you help me?

    Thanks.

    <simplegrid bottom="111" cols="16" left="30" right="30" rows="6" style="bdr:shadow;bg#modaloverlay;font:bold;size:Normal;" top="385">
    <param expand="true" height="50" left="195" oid="Sources" style="style:actionButton;bdr:round;font:bold;size:Big;bdr#modaloverlay;bg-align:center;t:bg#860808;t:font:bold;t:size:Normal;t:fg#panelfg;t:bdr:etched;t:txt-align:center;t:hi-u:Offtube_Panel_Old/arrow-33-32_Beyaz.png;t:look:round;f:bg#timerfg;f:size:Normal;f:fg#modaloverlay;f:hi-u:Offtube_Panel_Old/arrow-33-32_Siyah.png;" top="478" widget="radio-toggle" width="413"/>
    </simplegrid>
    <simplegrid cols="15" height="250" hspace="1" left="30" right="30" rows="3" scroll="vertical" style="bg#modaloverlay;bdr:shadow;" top="125" vspace="1">
    <param expand="true" height="50" left="195" oid="Destination" style="style:actionButton;bdr:round;font:bold;size:Big;bdr#modaloverlay;bg-align:center;t:font:bold;t:size:Normal;t:bdr:etched;t:txt-align:center;t:hi-u:Offtube_Panel_Old/arrow-33-32_Beyaz.png;t:look:round;t:bg#890808;t:fg#panelfg;f:size:Normal;f:fg#modaloverlay;f:hi-u:Offtube_Panel_Old/arrow-33-32_Siyah.png;f:bg#teal;" top="478" widget="radio-toggle" width="413">
    <task tasktype="ogscript">var Destination = params.getValue('Destination', 0);
    var selected5 = (params.getParam("Ultrix.1", 'params.statusByDestination.' + Destination + '.inputstatus', 0).getValue());
    params.setValue("Sources", 0, selected5);</task>
    </param>
    </simplegrid>
    <ogscript handles="onload" name="DestListener" targetid="Destination">var Dst=params.getValue('Destination', 0);
    var levelIndex=0;

    /* First time SourceName label set*/
    ogscript.debug('First time SourceName set');

    var sourceIndex = params.getParam("Ultrix.1", 'params.statusByDestination.' + Dst + '.inputstatus', levelIndex).getValue();

    params.setValue('Sources', 0, sourceIndex);

    /*Listener for future changes*/

    ogscript.debug('Creating listener');


    var oidString = 'params.statusByDestination.' + Dst + '.inputstatus';

    var paramObj = params.getParam('Ultrix.1',oidString, 0);

    var listenerObj = paramObj.addParamListener( function(param, changedIndex)
    {

    ogscript.debug('xpt change callback');
    var NewsourceIndex = params.getParam("Ultrix.1", 'params.statusByDestination.' + Dst + '.inputstatus', levelIndex).getValue();
    if (changedIndex == levelIndex)
    {
    ogscript.debug('Level is of interest, updating SourceName label');

    var newSourceIndex = params.getParam("Ultrix.1", 'params.statusByDestination.' + Dst + '.inputstatus', levelIndex).getValue();

    params.setValue('Sources', 0, newSourceIndex);
    }

    }, true);</ogscript>


    ------------------------------
    ferhat ozgun
    ------------------------------