英文:
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() )
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论