3

I need to Limit the characters in this field ${label.displayname} around 40.

marg
  • 91
  • 1
  • 12

1 Answers1

4

You can achieve this with a FreeMarker slicing expression -

${label.displayname[0..39]}

michoel
  • 3,725
  • 2
  • 16
  • 19
  • code is not working,getting an error in netsuite Range end index 39 is out of bounds, because the sliced string has only 16 character(s). (Note that indices are 0-based). The blamed expression: ==> 0..39 [in template "template" at line 49, column 39] only give limit between [0-16] – marg Jul 23 '18 at 10:37
  • 2
    @marg Then use `label.displayname[0..*39]`. The number after the `*` is the maximum length of the substring, rather than the last index. – ddekany Jul 23 '18 at 12:01
  • perfectly working but its counting white spaces also.Is there any way to avoid that – marg Jul 24 '18 at 04:28
  • how to avoid white-spaces while using the above code – marg Jul 25 '18 at 09:31