Sample Web Application
In this sample, the user enters the origin and destination ZIP codes for a shipment, along with the weight of the order. The ShippingCost Rule Application uses this information, along with the name of the carrier (Pigeon Air Freight) to calculate the shipping cost of the order. After the rules have been applied, the shipping cost is displayed back to the user.
The snippet performs these steps:
- Creates a shipRecord object from controls on the form
- Creates an InRule Entity from the shipRecord object
- Uses the applyRules function to run the Rule Application
- Places the calculated shipping cost in a form control
If an object is not passed in, one will be created by the engine for you. After applying rules, you may retrieve the entity using the getValue method (e.g. shipRecordEntity.getValue();).