SugarCRM使用IfElse计算字段,需要在条件为true时返回null。

huangapple go评论79阅读模式
英文:

SugarCRM Calculated field using IfElse, needs to return null on true

问题

我有一个这样构建的ifElse函数:

ifElse (条件,返回null,否则返回今天的日期)

目前我的函数返回自身。字段是一个名为course_date的日期:

ifElse (条件,$course_date,today())

并且在条件为真时返回0。这会导致错误,因为0不是日期,然后在提交时失败。

我想知道是否可能返回null或空字符串。

英文:

I have an ifElse function of this construct:

ifElse ( condition, return null, otherwise return today's date )

As things are currently my function returns itself. The field is a date called course_date:

ifElse ( condition, $course_date, today() )

and this returns 0 on condition true. This then causes an error as 0 is not a date and then fails when being submitted.

I would like to know if it is possible to return null or an empty string.

答案1

得分: 1

创建另一个名为 null_datetime 的日期时间字段(例如),默认值为 none。然后更改公式以在条件为真时显示该字段。

ifElse ( condition, $null_datetime, today() )
英文:

Create another datetime field called null_datetime (for example) with a default value of none.Then change the formula to display that field on true.

ifElse ( condition, $null_datetime, today() )

huangapple
  • 本文由 发表于 2023年2月7日 05:18:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/75366687.html
  • sugarcrm
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定