RhysJ
RhysJ

Reputation: 173

In NetSuite Adanced PDF Template, How Can I Convert a String Value to Numeric Value

When I loop through my "record.item" sequence, I try to record and print the item's line number.

It seems that item.line is a string, not a number. For Example:

<#list record.item as item>
    <#assign curLineNumber = item.line/>
    <#assign nextLineNumber = curLineNumber + 1/>
    <span>Curent Line #: [${curLineNumber}] --- Next Line #: [${nextLineNumber}]<br/></span>
</#list>

This prints out

Curent Line #: [1] --- Next Line #: [11]
Curent Line #: [2] --- Next Line #: [21]
Curent Line #: [3] --- Next Line #: [31]
.....

It looks like that item.line always gives me string value of line number, instead of numeric value.

Does anyone know how to solve this issue? Thanks

Upvotes: 0

Views: 2644

Answers (1)

Adolfo Garza
Adolfo Garza

Reputation: 3029

Try casting to number like this:

<#assign nextLineNumber = curLineNumber?number + 1/>

Upvotes: 1

Related Questions