lcp
2010-01-12 19:04:57 UTC
I am using Freemarker for a content.ftl file with Geoserver to be displayed
in OpenLayers.
I am not able to format my numeric values as strings. I can copy and paste
the examples from the freemarker FAQ page into my script and they do work.
These values are coming from a PostGIS database and are "numeric".
Could someone please tell me what they think I am doing wrong? I gave some
examples of code I have tried.
This is part of the error I get:
Expected method. x?string evaluated instead to
freemarker.template.SimpleScalar on line 17, column 3 in content.ftl. The
problematic instruction: ---------- ==> ${x?string("0")} [on line 17, column
1 in content.ftl] ---------- Java backtrace for programmers: ----------
freemarker.template.TemplateException: Expected method. x?string evaluated
instead to freemarker.template.SimpleScalar on line 17, column 3 in
content.ftl. at...
Thank you, LP
DOESN'T WORK
<#if attribute.name = "last">
<li>% of people living on less than $1 per day PPP - most recent
measurement of this indicator between 2002 and
2007:${attribute.value?string.currency}</li>
</#if>
</#list>
-----------------
DOESN'T WORK
${attribute.value?string(",##0.00")}</li>
-----------------
DOESN'T WORK
${attribute.value}</li>
<#assign x = attribute.value>
${x?string("0")}
------------------
DOES WORK
${attribute.value}</li>
<#assign x = attribute.value>
${x?string} <#-- the same as ${x} -->
------------------
DOES WORK
${attribute.value}</li>
<#assign x = 1.234>
${x?string("0")}
-----------------
in OpenLayers.
I am not able to format my numeric values as strings. I can copy and paste
the examples from the freemarker FAQ page into my script and they do work.
These values are coming from a PostGIS database and are "numeric".
Could someone please tell me what they think I am doing wrong? I gave some
examples of code I have tried.
This is part of the error I get:
Expected method. x?string evaluated instead to
freemarker.template.SimpleScalar on line 17, column 3 in content.ftl. The
problematic instruction: ---------- ==> ${x?string("0")} [on line 17, column
1 in content.ftl] ---------- Java backtrace for programmers: ----------
freemarker.template.TemplateException: Expected method. x?string evaluated
instead to freemarker.template.SimpleScalar on line 17, column 3 in
content.ftl. at...
Thank you, LP
DOESN'T WORK
<#if attribute.name = "last">
<li>% of people living on less than $1 per day PPP - most recent
measurement of this indicator between 2002 and
2007:${attribute.value?string.currency}</li>
</#if>
</#list>
-----------------
DOESN'T WORK
${attribute.value?string(",##0.00")}</li>
-----------------
DOESN'T WORK
${attribute.value}</li>
<#assign x = attribute.value>
${x?string("0")}
------------------
DOES WORK
${attribute.value}</li>
<#assign x = attribute.value>
${x?string} <#-- the same as ${x} -->
------------------
DOES WORK
${attribute.value}</li>
<#assign x = 1.234>
${x?string("0")}
-----------------
--
View this message in context: http://n4.nabble.com/formating-numeric-string-from-variable-tp1012376p1012376.html
Sent from the freemarker-user mailing list archive at Nabble.com.
View this message in context: http://n4.nabble.com/formating-numeric-string-from-variable-tp1012376p1012376.html
Sent from the freemarker-user mailing list archive at Nabble.com.