Netsuite 自定义字段可根据已填充的其他字段添加天数 [英] Netsuite Custom field to add days to date of other field based on which is filled

查看:73
本文介绍了Netsuite 自定义字段可根据已填充的其他字段添加天数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试在 Netsuite 中创建一个列字段,以根据填充的字段向日期添加天数.

I have been trying to create a column field in Netsuite to add days to a date based on which field is populated.

我遇到过 CASE 语句,我认为可以这样做,但我似乎无法让它发挥作用.

I have come accross CASE statements which I thought would do it but I cant seem to get it to work.

这是我目前所拥有的

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

任何帮助将不胜感激.

推荐答案

你的 case 语句有几个问题:

There are several issues with your case statement:

  1. 您需要在 之前测试一个条件 - 我认为您的意思是 {custcol_fob_date} 为空且 {custcol_stock_ready_date} 为空.如果没有第一个 is null 或其他一些与 {custcol_fob_date} 进行比较的测试,则表达式无效.
  2. 您在 else 之后的两个地方缺少 when.else 应该在没有 when 的情况下出现的唯一时间是在语句的末尾进行全能,然后应该在没有条件的情况下使用它进行测试.
  1. You need a condition to test before and - I think what you mean is {custcol_fob_date} is null and {custcol_stock_ready_date} is null. Without the first is null or some other test to compare {custcol_fob_date} with, the expression is invalid.
  2. You are missing when after else in two places. The only time else should appear without when is for a catch-all at the end of the statement, and then it should be used without a condition to test.

尝试以下操作(根据您的代码稍作修改):

Try the following (slightly revised from your code):

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

这在最后没有包罗万象,因此如果不满足任何条件,则不会设置任何值.

This does not have a catch-all at the end, so if none of the conditions are met, there will be no value set.

另请注意:您必须将该字段设置为动态(取消选中存储值"框)才能使其工作.

ALSO NOTE: You must set the field to dynamic (uncheck the 'Store Value' box) for this to work.

这篇关于Netsuite 自定义字段可根据已填充的其他字段添加天数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆