Highlighted
Acclaimed Contributor.
Acclaimed Contributor.
497 views

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

Jump to solution

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

0 Likes
1 Solution

Accepted Solutions
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: get current value from "display value" for current value from "list value" fr

Jump to solution

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)

 

Spoiler
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;
}

 

 

View solution in original post

0 Likes
4 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: get current value from "display value" for curren value from "list value" fr

Jump to solution

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!

If you find that this or any other post resolves your issue, please be sure to mark it as an accepted solution. If you are satisfied with anyone’s response please remember to give them a LIKE by clicking on the Thumb and show your appreciation.
0 Likes
Highlighted
Knowledge Partner
Knowledge Partner

Re: get current value from "display value" for curren value from "list value" fr

Jump to solution

Try i-1; JS array starts at 0.

Regards,
Breno Abreu

If you feel this was helpful please click the KUDOS! thumb below!
0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: get current value from "display value" for curren value from "list value" fr

Jump to solution

 

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

 

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: get current value from "display value" for current value from "list value" fr

Jump to solution

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)

 

Spoiler
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;
}

 

 

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.