Highlighted
Absent Member.
Absent Member.
291 views

What is wrong in the script?

Jump to solution
Hi experts,

Below is the script:

function getDep(device)
{
var p = new Array();
var c = new Array();
var d = new Array();
var t = new Array();
var o = new Array();
p=FindParentCIs(device);

c=FindChildCIs(device);
o = "The record has been updated by" +vars.$lo_user_name;
t = "at" +system.functions.tod();
d = (p.concat( c,o,t));
return(d);
}


While execution its giving following error:

Script 'test' line 123: ERROR TypeError: p has no properties at char 1

Cannot evaluate expression (format.ccal,calc.calculations)
0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.
Absent Member.
Hi,

which is line 123 in ur code ?

View solution in original post

7 Replies
Highlighted
Absent Member.
Absent Member.
Hi,

which is line 123 in ur code ?

View solution in original post

Highlighted
Absent Member.
Absent Member.
Hi Blue,

Its d = (p.concat( c,o,t));
0 Likes
Highlighted
Absent Member.
Absent Member.
Hi,

I have tried ur code with small change, but it has worked for me

var p = new Array();
var c = new Array();
var d = new Array();
var t = new Array();
var o = new Array();
var x = new Array()
x[0] ="Apple"
x[1]="Orange"
//var z="pooy"
p=x
o = "The record has been updated by" +vars.$lo_user_name;
t = "at" +system.functions.tod();
d=(p.concat(c, o, t))
print("Result"+d)

After execution:'

ResultApple,Orange,The record has been updated by *****,atMon Mar 21 2011 06:56:35 GMT-0500 (CDT)


so that means ur syntax is fine...make sure ther are no type error

0 Likes
Highlighted
Absent Member.
Absent Member.
Hi,

For me also is working if i am trying to print.

But when i am trying to return. Its throwing error.
0 Likes
Highlighted
Absent Member.
Absent Member.
Hi,

I can see 2 potential issues:
You concatenate Arrays (c,o and t)

but there is one line where you calculate t and assign something that is no array.

you could change to:
t = {"at" +system.functions.str(system.functions.tod());

Also did you check if c is always an array?
You could achieve that with
c=system.functions.nullsub(FindChildCIs(device), {});

--->
c=FindChildCIs(device);
o = "The record has been updated by" +vars.$lo_user_name;
t = "at" +system.functions.tod();
d = (p.concat( c,o,t));
<---

HTH
Lars
0 Likes
Highlighted
Absent Member.
Absent Member.
Hi,


thanks for your time. I did accroding to your suggestion but no luck. 😞

Is there any other way to concatenate arrays?

I am using following expression in device table:

comments in $file=jscall("test.getDep", logical.name in $file)

Update true

0 Likes
Highlighted
Absent Member.
Absent Member.
Hi Experts,

Any help on this?
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.