Number format issue using assign statement
kbutler <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Hi -
I am trying to do a calculation using an assign statement. This is the
script:
<#assign total = 0/>
<#list 1..q_client_income_rental_address_max?number as i>
<#assign var = "q_client_income_rental_income_${i}" />
<#if var?eval?? && var?eval?number gt 0><#assign
total=total+var?eval?number/></#if>
<#assign var = "q_client_income_rental_otherincome_${i}" />
<#if var?eval?? && var?eval?number gt 0><#assign
total=total+var?eval?number/></#if>
</#list>
${total?c}
My intention is that the result number is unformatted, i.e. for computer
audience. But, this script always produces a formatted number.
What is interesting is that putting debug print statements inside the loop
actually produces an unformatted result:
<#assign total = 0/>
<#list 1..q_client_income_rental_address_max?number as i>
<#assign var = "q_client_income_rental_income_${i}" />
<#if var?eval?? && var?eval?number gt 0><#assign
total=total+var?eval?number/></#if>
${total?c}
<#assign var = "q_client_income_rental_otherincome_${i}" />
<#if var?eval?? && var?eval?number gt 0><#assign
total=total+var?eval?number/></#if>
${total?c}
</#list>
${total?c}
the result being
4000
4250
4250
note that i = 1.
I have tried various syntax in the assign statements, with no luck. Doing
something like
<#assign total= (total+var?eval?number)?c />
produces an error saying that total is a SimpleScalar; using total?number
didn't help either.
I'm rather confused about this now. Am I doing something wrong? Why are
the debug printouts actually producing my desired result? I'm using FM
2.3.13.
Thanks for any ideas -
Kent
--
View this message in context: http://n4.nabble.com/Number-format-issue-using-assign-statement-tp1585333p1585333.html
Sent from the freemarker-user mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev