我在NetSuite保存的搜索中有一些案例公式,可以为特定位置的产品的成员项目(组件)提取可用数量。我想创建一个公式,以显示可用于特定位置(或排除特定位置)的这些组件的所有数量,作为搜索中每个组件的1个结果。
{memberitem.inventorylocation} ='位置1'然后{memberitem.locationquantityavailable} else null end
{memberitem.inventorylocation} ='Location 2'然后{memberitem.locationquantityavailable} else null end
{memberitem.inventorylocation} ='位置3'然后{memberitem.locationquantityavailable} else null end
如何在1个公式中找到这3个位置的{memberitem.locationquantityavailable}的总和?
答案 0 :(得分:1)
您没有具体说明您正在进行商品搜索,但如果是这样的话:
由于您引用了memberitem.inventorylocation
,因此默认情况下,您的搜索将始终为每个位置的每个成员项返回一行。您需要使用分组将多个位置的数量合并为一个值。也就是说,您可以将公式(数字)设置为:
case {memberitem.inventorylocation}
when 'Location 1' then {memberitem.locationquantityavailable}
when 'Location 2' then {memberitem.locationquantityavailable}
when 'Location 3' then {memberitem.locationquantityavailable}
else 0
end
在搜索结果中,您可以使用摘要类型'组'在项目名称(以及您需要在结果中看到的任何其他列)和' Sum'对于公式字段。
答案 1 :(得分:0)
您必须在NetSuite项目搜索的摘要类型中使用SUM,但是,此处是如何将案例公式的总和与其他公式一起使用的示例。
这用于根据成员项目的可用数量,需求(在其他地方计算并在自定义字段中填充)和分配给工具包的百分比(在其他地方计算并在自定义字段中填充)计算工具包的可用数量。 FLOOR用于向下舍入(因此您不会得到像1.11111111111111111这样的结果):
(Floor((case {memberitem.inventorylocation}
when 'Location 1' then{memberitem.locationquantityavailable}
when 'Location 2' then {memberitem.locationquantityavailable}
when 'Location 3' then {memberitem.locationquantityavailable}
when 'Location 4' then {memberitem.locationquantityavailable}
when 'Locatoin 5' then {memberitem.locationquantityavailable}
else 0 end)
*(({custitem_kit_demand}
*{memberquantity})
/NULLIF({memberitem.custitem_aggregate_component_demand},0))))
/NULLIF({memberquantity},0)