如何对案例公式的结果求和
How to sum results of case formulas
我在 NetSuite 保存的搜索中有一些案例公式,可以提取特定位置产品的成员项目(组件)的可用数量。我想创建一个公式来显示这些组件可用于特定位置(或排除特定位置)的所有数量,作为搜索中每个组件的 1 个结果。
case when {memberitem.inventorylocation} = 'Location 1' then {memberitem.locationquantityavailable} else null end
case when {memberitem.inventorylocation} = 'Location 2' then {memberitem.locationquantityavailable} else null end
case when {memberitem.inventorylocation} = 'Location 3' then {memberitem.locationquantityavailable} else null end
如何找到 1 个公式中这 3 个位置的 {memberitem.locationquantityavailable}
的总和?
您没有明确说明您正在进行商品搜索,但如果是:
由于您引用的是 memberitem.inventorylocation
,默认情况下,您的搜索总是 return 每个位置的每个成员项目一行。您需要使用分组将多个位置的数量合并为一个值。也就是说,您可以将公式(数字)设置为:
case {memberitem.inventorylocation}
when 'Location 1' then {memberitem.locationquantityavailable}
when 'Location 2' then {memberitem.locationquantityavailable}
when 'Location 3' then {memberitem.locationquantityavailable}
else 0
end
在搜索结果中,您可以在项目名称(以及您需要在结果中看到的任何其他列)中使用摘要类型 'Group',在公式字段中使用 'Sum'。
您必须在 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)
我在 NetSuite 保存的搜索中有一些案例公式,可以提取特定位置产品的成员项目(组件)的可用数量。我想创建一个公式来显示这些组件可用于特定位置(或排除特定位置)的所有数量,作为搜索中每个组件的 1 个结果。
case when {memberitem.inventorylocation} = 'Location 1' then {memberitem.locationquantityavailable} else null end
case when {memberitem.inventorylocation} = 'Location 2' then {memberitem.locationquantityavailable} else null end
case when {memberitem.inventorylocation} = 'Location 3' then {memberitem.locationquantityavailable} else null end
如何找到 1 个公式中这 3 个位置的 {memberitem.locationquantityavailable}
的总和?
您没有明确说明您正在进行商品搜索,但如果是:
由于您引用的是 memberitem.inventorylocation
,默认情况下,您的搜索总是 return 每个位置的每个成员项目一行。您需要使用分组将多个位置的数量合并为一个值。也就是说,您可以将公式(数字)设置为:
case {memberitem.inventorylocation}
when 'Location 1' then {memberitem.locationquantityavailable}
when 'Location 2' then {memberitem.locationquantityavailable}
when 'Location 3' then {memberitem.locationquantityavailable}
else 0
end
在搜索结果中,您可以在项目名称(以及您需要在结果中看到的任何其他列)中使用摘要类型 'Group',在公式字段中使用 'Sum'。
您必须在 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)