While looking at the examples below, you will notice that they all depend on the environment variables being set up correctly. The BBL was designed to be a simple rules-engine type of programming language that can be understood and created by non-programmers: the business people. It was therefore intended to be part of a larger system - one that will set these variables up to the appropriate values before these example programs will be run. Using the With statement you could - for the most part - set up the variables within the program itself, but that defeats the purpose slightly and should only be used in this fashion as examples.
Note: Some minor features may not be supported yet, but these examples are all planned to work for version 1.0.
Even though this is a fairly simple pricing engine, it does do a good job of showing off some of the capabilities of the BBL. You will see the following:
The following variables must be set in the environment:
Variable Name | Type | Description |
---|---|---|
Cost | Number | The base cost of the item being priced |
Category | Text | The category name of the item being priced. |
AccountNumber | Number | The account number for the customer the items is priced for. |
CreditCard | Text | The payment terms of the transaction |
CouponCode | Text | A coupon code that will be applied to the transaction |
CouponDiscount | Lookup | A lookup table with key CouponCode, and a Number as a value - the coupon’s value. |
CCFeeExempt | Logical | True if the customer is exempt from credit card fees. |
The Result of this program will have four parts:
Result Part | Description |
---|---|
Default | The default result will have the final sellprice. |
BaseMargin | The base margin total. |
Discounts | The total discount applied, including coupons and other special discounts |
CreditCard | The Credit Card fee baked into the sellprice. |
for BaseMargin do add 15% of Cost add 1% of Cost if Category == "Higher Expense Items" end for Discounts do add CouponDiscount add 2.50 if AccountNumber in [100, 101, 102, 103] /* Special Customers */ end for CreditCard add 2% of (BaseMargin - Discounts) if PaymentTerms == "CreditCard" and not CCFeeExempt set BaseMargin - Discounts + CreditCard