如何将字段值与电子邮件模板中的数字进行比较
如果发票总价值小于 5,000,我需要能够显示一行文本。我尝试了以下代码,但收到错误:
<#if transaction.total < 5000>Total is less than 5K</#if>
我收到的错误如下:
无法比较这些类型的值。允许的比较范围是 两个数字、两个字符串、两个日期或两个布尔值。左手操作数是哈希+字符串(包装器:com.netledger.model.StringModel)..右手操作数是数字(weapper:ftSimpleNumber)..被指责的表达式:==>交易总额< 1000 [在模板“内容”第 14 行第 6 列]..----,FTL 堆栈跟踪(“~”表示与嵌套相关):失败于:#if transaction.total %lt; 1000
我该如何解决这个问题?
编辑以添加完整的错误消息。
I need to be able to show a line of text if the total value of an invoice is less than 5,000. I tried the below code but am getting an error:
<#if transaction.total < 5000>Total is less than 5K</#if>
The error I am getting is the following:
Can't compare values of these types. Allowed comparisons are between
two numbers, two strings, two dates, or two booleans.Left hand operand is a hash+string(wrapper: com.netledger.model.StringModel)..Right hand operand is a number (weapper:f.t.SimpleNumber)..The blamed expression: ==> transaction.otal < 1000 [in template "content" at line 14, column 6]..----,FTL stack trace ("~" means nesting-related): Failed at: #if transaction.total %lt; 1000
How can I fix this?
Edited to add complete error message.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
错误消息表明您显示的代码不是正在运行的代码:
从错误中,模板具有
transaction.otal
nottransaction.total
The error message indicates the code you show is not the code that is running:
From the error the template has
transaction.otal
nottransaction.total
这很奇怪。我查看了我的模板,发现我从未比较过任何交易货币字段。不过它们确实像数字一样工作,所以你可能只需要稍微强制它们即可。请注意,您不需要转义小于号
try:
或
that's odd. I've looked through my templates and realized I've never compared any transaction currency fields. They do work as numbers though so you probably just need to coerce them a little. Note you don't need to escape a less than sign
try:
or