get current value from "display value" for current value from "list value" from GlobalList

I have some GL named - devtypes

There is list variable named $G.devtypes and display variable neamed $G.devnames

I need in JS find value from $G.devtypes (list) and store  associated value from$G.devnames (names)

I did try use $G.devtypes[i] - to get value, this is work in RAD debagger, but in JS i get null for [i]-element

  • Hello ALARMus,
    Thanks for your question.

    You might consider add trace parameters, specially RTM:4 so you can get further information. Then, manipulate the field you need and you should obtain that information.

    BR!

  •  

    for(var i=0;i<array.length();  i)

     

  • Verified Answer

    So if somebody need it. I made it.

    In ESS menu set HTML view which call JS

    (in my configuration, CI have the following hierarchical \dependent types:

    Type->subtype->sub.subtype,

    for example: 

    Type can be: Documentation, Hardware, License,...

    subtype for Hardware can be: Server's equipment, Telecommunication, Supplies, Computer aids,...

    sub.subtype for Computer aids:  Computer, Notebook, Monitor,...

    but for Type=License there is no data in subtype and sub.subtype, they are null)

     

    function getSubscrList()
    {
        var html = lib.htmlTemplates.getEssTemplate();
        html  = "<DIV class=\"resultTable\">";
        html  = "<TABLE class=\"listTable\" cellpadding=\"0\" cellspacing=\"10\" width=\"100%\">";
        html  = lib.HtmlEngine.getTableHeader("valign=top CLASS=\"evenRow\"", "ID", "Type","Title", "Model");
    
    	var UserName = vars.$lo_contact_name;
        var SubscrTable = new SCFile("Subscription");
        var DeviceTable = new SCFile("device");
        var SQLSubscr = 'subscriber = "' UserName '" and status = "Active"'
    
        if (SubscrTable.doSelect(SQLSubscr) == RC_SUCCESS)
       	{
       		do
       		{
       			var SubscrLN = SubscrTable.serviceName;
    			var SQLDevice = 'logical.name="' SubscrLN '"';
    		    if (DeviceTable.doSelect(SQLDevice) == RC_SUCCESS)
    		    {
    				var DevID = lib.MOSUtils.StringDenull(DeviceTable.id);
    				var DevModel = lib.MOSUtils.StringDenull(DeviceTable.model);
    				var Devtitle = lib.MOSUtils.StringDenull(DeviceTable.title);
    				if (DeviceTable.sub_subtype != null)
    					var DevVid = DeviceTable.sub_subtype;
    				
    				else if (DeviceTable.subtype != null)
    						var DevVid = DeviceTable.subtype;
    				else
    				{
    				var i = indexOf(MakeJSArray(vars.$G_devtypes), DeviceTable.type);
    				var DevVid = MakeJSArray(vars.$G_devnames)[i];
    				}
    				DevVid = StringDenull(DevVid);
    				html  = lib.HtmlEngine.getTableRow("valign=top CLASS=\"oddRow\"", DevID, DevVid, Devtitle, DevModel);
    	   	    }
    		}
     		while ( SubscrTable.getNext() == RC_SUCCESS );
        }
       html  = "</TABLE></DIV>";
       return html;
    }

    function MakeJSArray(data)
    {
    var JSArray = new Array()
    if (system.functions.type(data) == 8)
    {
    for (var i in data)
    {
    JSArray.push(data[i]);
    }
    }
    else
    {
    JSArray.push(data);
    }
    return JSArray;
    }

    function indexOf(array, value)
    {
    if (isEmpty(array) || value == null)
    return -1;
    for (var i=0; i < array.length; i )
    {
    if (array[i] == value)
    return i;
    }
    return -1;
    }

    function StringDenull(StringData)
    {
    var DenullStringData="";
    if (StringData != null)
    return StringData;
    else
    return DenullStringData;
    }