case - CASE WHEN Formula - NetSuite
问题描述
I'm trying to get results for a field with Formula (Text). The idea is - if the subsidiary = A, then show field 1. If subsidiary = B, then show field B. (please see the formula below). For some reason, I didn't get any results. Both fields are transaction column fields. When I'm testing only the fields (without formula - just the name of the field) they work.
Type of the Saved Search is: Transaction Main Line is: False
Case when {subsidiary}='A' THEN {field1} when {subsidiary}='B' THEN {fieild2} END
For the records which belong to the Subsidiary A field 2 is empty and for the Subsidiary B - field 1 is empty accordingly. Therefore I would like if the Subsidiary is A to populate field 1 and if it's B to populate filed 2. Can you please advise how to achieve this?
Thank you in advance.
解决方案
该{subsidiary}
字段期望整个父子层次结构进行匹配,因此“Honeycomb Holding Inc. : Honeycomb Mfg.” . 您可以使用 `{subsidiarynohierarchy} 来匹配交易所在的基本子公司名称(即Honeycomb Mfg.)。这个公式应该有效:
case
when {subsidiarynohierarchy} = 'Honeycomb Mfg.' then {field1}
when {subsidiarynohierarchy} = 'test sub' then {field2}
end
如果没有ELSE
提供子句并且没有找到匹配项,它将返回一个空结果。
对于属于子公司 A 的记录,字段 2 为空,对于子公司 B - 字段 1 相应地为空。
如果,正如您所提到的,这些字段仅为给定的子公司填充,那么您可以将公式简化为:
coalesce({field1}, {field2})
这将返回第一个非空值,因此如果子公司 A 已field1
填充,它将返回field1
。如果子公司 B 为field1
空且field2
已填充,它将返回field2
。
推荐阅读
- java - 如何使用 Java 设置 Logitech 的 LED 照明 SDK?
- c++ - 我的程序的输入在没有第一个字符的情况下打印出来
- c++ - C ++调用外部exe - 不传递参数
- php - 试图运行 Mutillidae
- c# - 是否可以从 API 请求中获取 AccessToken?(脸书开发者)
- javascript - 在 nextJs 中找不到 _app.js
- hibernate - java.lang.IllegalArgumentException:org.hibernate.hql.internal.ast.QuerySyntaxException:意外令牌:第 1 行附近为空,
- javascript - 我有一个字符串“aabbbccdda”,我需要输出为“a2b3c2d2a1”
- javascript - Javascript 中的匿名函数 - 为什么是间接的?
- reactjs - Google Map React Throwing“拒绝应用内联样式错误”