我一直在尝试在Netsuite中创建一个列字段,根据填充的字段为日期添加天数。
我已经遇到了CASE声明,我认为会这样做,但我似乎无法让它发挥作用。
这是我到目前为止所拥有的
case when
{custcol_fob_date} and {custcol_stock_ready_date}is null then
{shipdate}+40 else
{custcol_stock_ready_date}is null then
{custcol_fob_date}+30 else
{custcol_fob_date} is null then
{custcol_stock_ready_date}+35
END
任何帮助都将不胜感激。
答案 0 :(得分:1)
您的案例陈述有几个问题:
and
之前测试条件 - 我认为您的意思是{custcol_fob_date} is null and {custcol_stock_ready_date} is null
。如果没有第一个is null
或其他测试来比较{custcol_fob_date}
,则表达式无效。 when
之后,你遗失了else
。 else
唯一出现when
的时间是在语句结尾处进行全面捕获,然后应该在没有条件的情况下使用它来进行测试。尝试以下操作(稍微修改一下代码):
case when
{custcol_fob_date} IS NULL and {custcol_stock_ready_date} is null then
{shipdate}+40 else WHEN
{custcol_stock_ready_date} is null then
{custcol_fob_date}+30 else WHEN
{custcol_fob_date} is null then
{custcol_stock_ready_date}+35
END
这在最后没有一个包罗万象,所以如果没有满足任何条件,就没有设置值。
另请注意:您必须将字段设置为动态(取消选中“存储值”框)才能使其生效。