Siebel Advisor API Reference > Siebel Advisor API Examples >
Example of Adding Custom Behavior with a Callout Point
This example adds custom behavior to be executed before the configuration engine runs. Using values from the Feature tables for selected rows, an input selection value is calculated and set. function COP_BeforeConfiguration(privateArg1,
privateArg2,instanceName,configData,featureData,
privateArg3,inputState,privateArg4,privateArg5) {
// get the current selection for the packing method
var pmVal=inputState.GetValue("PACK_METHOD",instanceName);
// if the packing method selection is to use cartons,
// calculate and set the number of cartons
if (featureData.GetTable("PACK_METHOD").GetRowCode(pmVal)== "CARTON") {
// get quantity of eggs
var eggSel=inputState.GetValue("EGGS",instanceName);
var total=featureData.GetTable("EGGS").GetTableCell(eggSel, "QTY");
// calculate how many cartons are needed
var eggsPerCarton= featureData.GetTable("PACK_METHOD").GetTableCell(pmVal, "EGGS_PER_CONTAINER");
var numCartons=parseInt(total/eggsPerCarton);
if (total%eggsPerCarton!=0) numCartons++;
// set the selection of CARTONS to numCartons.
inputState.SetValue("CARTONS",instanceName,numCartons);
|