This topic contains 4 replies, has 0 voices, and was last updated by michoel 8 years, 10 months ago.
-
AuthorPosts
-
January 11, 2016 at 1:08 am #2927
GAJAppreciate your help on the syntax to remove a dash or add a percent sign to an incoming discount amount that could be either an actual amount, or a percentage amount.
For example the discount may be -10.00 (meaning dollars) or 10 (meaning percentage).
If -10.00 the result s/be 10.00.
If 10, the result s/be 10%.
Easy stuff if one knows the syntax.
Very much appreciate the help.
This is a cached copy. Click here to see the original post. -
January 11, 2016 at 9:01 am #2928
al3xiconI would use REGEXP_REPLACE and leverage regular expressions:
REGEXP_REPLACE(‘test-te%st-‘, ‘[-%]’, ”) // returns “testtest”
You can also do nested REPLACE statements as such:
REPLACE(REPLACE(‘test-te%st-‘, ‘%’, ”), ‘-‘, ”)
-
January 11, 2016 at 9:27 pm #2929
GAJThanks al3xicon… very much appreciated.
Yet, a followup question please is how would you code this inside either an
Invoice PDF/HTML Template
line, e.g. ${record.???} , or in a
Custom Transaction Body Field’s DEFAULT VALUE/Formula field?
Sorry I have to ask. I’ve limited trial-and-error time on this and have to throw it out here.
Gary
-
January 12, 2016 at 6:04 am #2930
al3xiconI see…unfortunately I have never done this in a template, however I wonder if you can use the method described here: https://netsuite.custhelp.com/app/an…il/a_id/13622/. It may look something like this:
No idea if that will work, but may be worth a shot.
-
January 12, 2016 at 3:27 pm #2931
michoelYou can do this in a template with the ‘replace’ builtin, e.g.
Code:
${record.field?replace(‘%’, ”)?replace(‘-‘,”)}Sorry I have to ask. I’ve limited trial-and-error time on this and have to throw it out here.
There is nothing to apologise for, that’s what this forum is for
-
AuthorPosts
You must be logged in to reply to this topic.
