如何将字段值与电子邮件模板中的数字进行比较

发布于 2025-01-16 14:19:38 字数 482 浏览 2 评论 0原文

如果发票总价值小于 5,000,我需要能够显示一行文本。我尝试了以下代码,但收到错误:

<#if transaction.total &lt; 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

挽清梦 2025-01-23 14:19:38

错误消息表明您显示的代码不是正在运行的代码:

从错误中,模板具有 transaction.otal not transaction.total

The error message indicates the code you show is not the code that is running:

From the error the template has transaction.otal not transaction.total

月亮是我掰弯的 2025-01-23 14:19:38

这很奇怪。我查看了我的模板,发现我从未比较过任何交易货币字段。不过它们确实像数字一样工作,所以你可能只需要稍微强制它们即可。请注意,您不需要转义小于号

try:

<#if (0+transaction.total) < 5000>Total is less than 5K</#if>

<#if transaction.total?number < 5000>Total is less than 5K</#if>

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:

<#if (0+transaction.total) < 5000>Total is less than 5K</#if>

or

<#if transaction.total?number < 5000>Total is less than 5K</#if>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文