Substring till a blank space in advanced HTML/PDF template

If the field value we receive is “998529 Other security services nowhere else classified,” but we only want the first token up to the space (998529 ), we can use Advanced Printing’s built-in “substring” and “index_of” functions.

Sample code:

<#if item.custcol_in_hsn_code?has_content>
      <#assign hsn_code = item.custcol_in_hsn_code?substring(0, item.custcol_in_hsn_code?index_of(" "))>
    <#else>
      <#assign hsn_code = " "> //if the field is empty
    </#if>

Leave a comment

Your email address will not be published. Required fields are marked *