Acclaimed Contributor.. brav0 Acclaimed Contributor..
Acclaimed Contributor..
540 views

Script help.

Jump to solution

Hi Experts,

 

 I am trying to get a particular label value from the user selection option of a particular catalog. Below script is getting called from the incidents fc from calculation on add "not null(svc.options in $file)".

calc : $L.void= jscall("TEST5.findSvcOpt",svc.options in $file)

 

function findSvcOpt(svcOption) {
	print("call from incidents formatctrol");
	var myXML,m,n,l,val;
	myXML = new XML();
	var myRC = myXML.setContent(svcOption);
	
	do {
		n = myXML.getFirstChildElement()
		print("value of first element is " +n);
		val = n.getAttributeNode('label').getText();
		if (val == "My Account*"){ 
		m = n.getValue();
		print("Value of the my Account is " +m);
		}
		else{
		print("Name of the attribute is " +val);
		l = n.getValue();
		print("Attribute value is " +l);
		}		
	} while(val == "My Account*")
}
	

 

Though the call is coming to the script, It prints only the first Node element value. it is not iterating and going to the attributeName (val =="My Account*") where "My Account*" is the label in the XML .

 

Is there something wrong with the script ?.

 

Please guide

 

Thank you

brav0

I am Listening..
0 Likes
1 Solution

Accepted Solutions
Acclaimed Contributor.. brav0 Acclaimed Contributor..
Acclaimed Contributor..

Re: Script help.

Jump to solution

Hi Experts,

 

I have fixed the js to get the node value. Its working fine and I am able to get the node value  from svc.options field into an 'incidents' table field

 

 

One query regarding the actual requirement.  The requirement was to actually pull up an XML field node value on to another field  for reporting purpose. I have actually done this through the JS call from the incidents fc  'calculations' and setting the return value on to the field.

 

Kindly let me know if this is the right approach. My thought process was only to populate the new field created from the xml field node value ..

 

Please guide.

 

Thank you.

I am Listening..

View solution in original post

0 Likes
4 Replies
Acclaimed Contributor.. brav0 Acclaimed Contributor..
Acclaimed Contributor..

Re: Script help.

Jump to solution
function findSvcOpt(svcOption) {
	print("call from incidents formatctrol");
	var myXML,m,n,l,val;
	myXML = new XML();
	var myRC = myXML.setContent(svcOption);
	n = myXML.getFirstChildElement();
	
	do {
	
		print("value of Child element is " +n);
		val = n.getAttributeNode('label').getText();
		
		if (val == "MY Account*") { 
		m = n.getValue();
		print("Value of the My Account is " +m);
		}
		
		else {
		print("Name of the attribute is " +val);
		l = n.getValue();
		print("Attribute value is " +l);
		n = n.getNextSiblingElement();
		print(n);
		}		
		
	} while (val== "My Account*")
}
	

 

 

Missed the exact code while pasting. the previous was not having the getNext. Even this one doesnt go to My Account Label, though I am filling the below field labels in the user selection . below is the body of the form, from which I am trying to get the value of the "My Account*"

 

<form><text id="join" label="Name *"/><text id="date" label="date of Birth(dd-mmm-yyyy) *"/><text id="id" label="My Account*"/><text id="computer" label="Computer Hostname (e.g. NLYBSTQVP1NB49)"/><text id="contacto" label="Contact for this request"/></for

 

 

Please guide.

 

Thank you

brav0

 

I am Listening..
0 Likes
Absent Member.. Michal_Kovac Absent Member..
Absent Member..

Re: Script help.

Jump to solution

mistype, line:

if (val == "MY Account*") {

... should be:

if (val == "My Account*") {

 

Acclaimed Contributor.. brav0 Acclaimed Contributor..
Acclaimed Contributor..

Re: Script help.

Jump to solution

Hi Experts,

 

I have fixed the js to get the node value. Its working fine and I am able to get the node value  from svc.options field into an 'incidents' table field

 

 

One query regarding the actual requirement.  The requirement was to actually pull up an XML field node value on to another field  for reporting purpose. I have actually done this through the JS call from the incidents fc  'calculations' and setting the return value on to the field.

 

Kindly let me know if this is the right approach. My thought process was only to populate the new field created from the xml field node value ..

 

Please guide.

 

Thank you.

I am Listening..

View solution in original post

0 Likes
Absent Member.. DJ_oo5 Absent Member..
Absent Member..

Re: Script help.

Jump to solution

Experts,

 

Any help is highly appreciated.

 

Thank you

 

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.