LookupSplitTotalByOrderCodeItemCode
The LookupSplitTotalByOrderCodeItemCode
scalar function takes a sales order order_code
and item_code
as input parameters. It returns the sum of staging.order_item_assignment.split_amount_pct
for the given combination.
Syntax
LookupSplitTotalByOrderCodeItemCode(<string>, <string>) |
The first parameter is for order_code
, use the second for item_code
.
Return Type
Decimal
Details
You might use the function to ensure split percentage totals meet some threshold specific to your implementation before uploading staging table orders into Incent. For example, split percentages must sum to 100.
Examples
select LookupSplitTotalByOrderCodeItemCode(order_code, item_code), if LookupSplitTotalByOrderCodeItemCode(order_code, item_code) != 100 then 'Error' else 'Ok' end, order_code, item_code from staging.order_item where LookupSplitTotalByOrderCodeItemCode(order_code, item_code) is not null;
Related Functions
n/a