Highlighted
Absent Member.
Absent Member.
266 views

Converting Variable to Array

Hi 

I'm sending data from HPSM to another tool using web services.

when I'm sending update($pmc.actions) which is a variable field, the values coming is like:-

Update from XYZ tool:: test call, test,test,test,test,test,test,test,

 

But actually I am giving value like below, using separate line.

Update from XYZ tool:: test call

test

test

test

test

 

Can anyone tell me how to replace comma(,) with new line.

0 Likes
5 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Converting Variable to Array

Try replacing commas with  \0a

 

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Converting Variable to Array

Actually I was looking for the sample code which can run in trigger

 

 

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Converting Variable to Array

I used below script to slipt text from comma and replace it with new line, but not giving expected result.
I'm using this in trigger.


var action = system.var$pmc.actions.toArray();
var full = action.split(","); var fullaction = [];
fullaction = full.replace(/\,/g,"\n");
print("Update is: "+fullaction);
0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Converting Variable to Array

You have a typo in the first line.  It should be:

var action = system.var.$pmc_actions.toArray();

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Converting Variable to Array

yes, my typo its var action = system.var.$pmc_actions.toArray();

while compiling I'm getting success , but while running its neither recognizing "spilt" neither "replace".

Any idea?

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.