Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

substring or slice function in ISF

substring or slice function in ISF

rc2008.3
Oracle10g
Websphere 6.1
IE6 & IE7

Has anyone used either the ".substring(x,y)" or ".slice(x,y)" functions in version 2008?

I tried the following javascript on load and I get blank results.

a0001_CMN_PARSE_CUSTOMER_OTHER()
{
  var mgr=serviceForm.Customer_Information.Other.getValue();
 mgr=mgr.slice (6,3);
  alert(mgr);
}

serviceForm.Customer_Information.Other contains "uid=dfaus00,o=people"

Thank you
Daniel

Everyone's tags (1)
12 REPLIES
New Member

substring or slice function in ISF

I think what you're looking for is:

mgr=mgr.slice(4,10); // should return "dfaus00"

WIth the slice statement, the second parameter it uses a zero-based index value of where the substring should end.  You could put in a negative value if you want to go from the end of the string toward the front.

To make this more dynamic, you may want to use search in combination with slice.  Something like this:

var mgr=serviceForm.Customer_Information.Other.getValue();

var firstComma = mgr

New Member

substring or slice function in ISF

thank you for the input, I am not sure why, but I am returning "blank" see screen shot...
No js errors, just nothing...

New Member

substring or slice function in ISF

one more note...

when I ran the installer, I used "C:\java\jdk1.6.0_13".
could this be causing some conflict with my ISF?

I tried the EXACT script that you suggested and I get the error "object not suported"

Thank you
Daniel

New Member

substring or slice function in ISF

You know, it may not view the value as a string. So first convert the value to a string, then use slice.

mgr=mgr.toString();

mgr=mgr.slice(4,10);

The JDK should only effect Java JRE, not JavaScript. :-)

New Member

substring or slice function in ISF

try printing out an alert right after you set mgr and see if it's getting set at all.

New Member

substring or slice function in ISF

thanks James, I used the code you provided and still getting blank results...

there is no JS error, just a blank result...
I've included the screen shot of the results...
I am trying to parse the "Management" chain"

thank you
Daniel

New Member

substring or slice function in ISF

I recently had a field that was comma separated. I used the split function, which tokenizes a string and returns an array of strings, based on a separator char that you pass to the function.  You can either loop through the array or reference an array element directly. 

var strlArray = new Array();

strArray = str.split(",");  //tokenize string

for ( i in strArray)  {

  var value = strArray[i];

 ....      //process each token

}

var value = strArray[0]  //reference

New Member

substring or slice function in ISF

Use the JavaScript substring() method for string manipulation.

slice() is for arrays.

New Member

substring or slice function in ISF

thanks All, but for what ever reason, I can not get these functions to work...
I get  "invalid Object" when I try using the substring command.
Maybe its my environment.

I am taking the "Ext Person Profile.Custom 1" value which is a 200 string
and trying to parse out a substring of that.

I would be happy to do an webex with someone if they can guide me in to get this to work...

Thank you
Daniel

New Member

substring or slice function in ISF

Thank you all - THIS QUESTION IS SOLVED.

Once I corrected the JS errors from the imported services, the slice function started working properly.

Thanks again
Daniel
Safeway

New Member

substring or slice function in ISF

Hi Daniel -

The call to the getValue() for a field returns an arrary object.  Try this:

var mgr=serviceForm.Customer_Information.Other.getValue()[0];

Adding the "[0]" sets the variable to the first item in the array which should be the string value of the field.

Maybe that will do something different.  Good luck!

New Member

substring or slice function in ISF

Hi Daniel, let me know if you still need a Webex.

235
Views
0
Helpful
12
Replies