- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-10-2018 01:37 PM
Hi,
I am trying to use substring() function to extract a part of the variable value and pass it on the target record but it is not working. Actually, I want to remove the '$' sign from the value and take the rest of the string. I am able to pull the whole value but not a substring. Have tested by logging results in gs.log.
Can anyone please help?
Any help will be highly appreciated.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2018 07:56 AM
Just go with:
var capexSwCost = (producer.Software_CapEx_Cost.toString()).replace("$", "");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2018 07:35 AM
I have tried converting the variable value to string as well. Still it is not working.
var CapexSwCost = producer.Software_CapEx_Cost;
var CapexSwCost1 = CapexSwCost.toString();
gs.log('CapEx SW Cost from RP in local substring var is ' + CapexSwCost1.substring(1)); // this line is showing the result as 'undefined'
gs.log('CapEx SW Cost from RP in local var is ' + CapexSwCost);
gs.log('CapEx SW Cost from RP in RP var is ' + producer.Software_CapEx_Cost);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2018 07:56 AM
Just go with:
var capexSwCost = (producer.Software_CapEx_Cost.toString()).replace("$", "");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2018 12:44 PM
It worked, but, I am still surprised why substring() was not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2018 07:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2018 08:21 AM
End of string is not a mandatory parameter. I need the full string from 2nd character.