Customization Tutorial for Duwamish Books, Phase 3.5: VBA

Chris Bova
Summit Software Company

December 1999

Summary: Describes the new features included in Duwamish Books, Phase 3.5: VBA (4 printed pages) Discusses:

Introduction

This tutorial provides a step-by-step guide through a typical usage of Duwamish Books, Phase 3.5: VBA. After performing this tutorial, you should have an understanding of the new features in Duwamish Books, Phase 3.5: VBA and how customization with VBA enhances the application.

Customizing the Ordering Process

Microsoft® Visual Basic® for Applications (VBA) can be used to customize the ordering process by customizing the business rules on the middle tier. For example, Phase 3.5 of Duwamish Books does not contain rules relating to what staff can order. Phase 3.5: VBA uses VBA to customize the ordering process and, in this example, restrict the size and value of orders.

In this article, we will:

Placing an Order

The Order client is particularly important to Duwamish Books, Phase 3.5: VBA, because it is one of two client applications that use VBA-enabled methods on the BLL.

To place an order

Start the Duwamish application by running the Duwamish Launch Control, log on as employee Kevin Learner (User Name: "Kevin" and Password: "Motorcycle").

Note   Kevin is used here as an example. Any user without administrator rights could be used in this part of the sample. Later the administrator account will be used to create VBA code behind the BLL InsertOrder method.

  1. Open the Order client.

  2. Create a new Purchase Order, and place an order for, say, ten thousand copies of item 735: "Rosencrantz and Guildernstern are Dead" from the supplier "Remainders R Left" (Kevin is apparently a huge Stoppard fan.)

  3. Submit this purchase order and close the Order client.

Note   If you have any trouble using the Order client, consult the "Order Entry User Guide" in the Help file included with the downloadable application.

Notice that any employee can enter an order for any number of books. Duwamish Books places no restrictions on who can order what.

Installing a Customization Project

Fortunately for our hypothetical administrator, Duwamish Books, Phase 3.5: VBA comes with a sample customization that, among other things, prevents non-administrative users from purchasing more than one hundred books, or a thousand dollars worth of books, or more than fifty of any one book at a time. We'll import and install this customization project using the Modifier. Remember that you must be logged on as the administrator in order to use the Modifier, so you may need to log off and on again to change your identity. Launch the Modifier and make sure you are customizing the Order component. (The option buttons to the left of the Project Store View will allow you to change which component you are currently customizing.)

To install a customization project

  1. Return to the Duwamish Launch Control, log on the Administrator (User Name: "admin" and Password: "password").

  2. From the Tools menu, select Show VBA IDE.

  3. When the IDE appears, from the File menu, select Import Project.

  4. Navigate to the location of the Duwamish Books, Phase 3.5: VBA examples folder, and select Order.vba to be imported.

  5. Once the import is finished, save and deploy it to the server. From the File menu select Save Project.

  6. Close the IDE and return to the Modifier. There should now be an entry in the Project Store View for your new customization, which is deployed to your server but not yet operational. To make your new modification active, select it and choose Install Project from the File menu. The Project Store View should change to reflect the new status of your modification.

For more information on authoring order customizations in the Modifier, consult the "Modifier User Guide."

Placing the Same Order

Log in as Kevin one last time, return to the Order client, and try to repeat your order of ten thousand books. Your customization project will then block the processing of the order and gently admonish you for your spendthrift ways.

Customizing the Buyer Performance Model

VBA can also be used to customize the performance model used for assessing members of staff who purchase books for the stores. The Buyer customization allows the VBA programmer to write a model that calculates a points-based scheme for buyers based on their activities during a given period. This can be based on various factors, such as the number of orders placed, the number of books purchased, or the number of unfulfilled orders.

Next, we will:

Entering Orders into the System

Gathering Employee Information with the Buyer Client

Log on to the Duwamish Books system as the administrator. The Buyer client application allows administrators and buyers to see information about outstanding purchase orders, book sales, and employee performance. These views can be navigated through the tabs. Under the "Outstanding POs" view you'll see a summary of purchase orders. The Performance tab will show you a range of information about different employees' purchasing activities, including the number of outstanding POs, their value, and a "Points" category that VBA can customize to rank your employees against each other. For now, the performance points are always zero because we didn't provide a customization that evaluates the performance points. As always, if you have trouble using the Buyer client, consult the "Buyer Client User Guide." When you are finished, close the Buyer client and return to the Duwamish Launch Control.

Installing a Customization Project

Duwamish Books, Phase 3.5: VBA also comes with sample customization that provides a sample performance point formula. This sample customization can be installed in a similar fashion as the sample customization for the ordering process.

To install a customization project

  1. As before, launch the Modifier after logging on as administrator.

  2. Select the Buyer modification using the option button on the left hand side of the Project Store View.

  3. From the Tools menu, select Show VBA IDE.

  4. When the IDE appears, from the File menu, select Import Project.

  5. Navigate to the location of the Duwamish Books, Phase 3.5: VBA examples folder, and select Buyer.vba to be imported.

  6. Once the import is finished, save and deploy it to the server. From the File menu select Save Project. You will see a new entry in the Project Store View.

  7. Deploy this project to the server using the Save command, and you will see a new entry in the Project Store View.

  8. Close the IDE and return to the Modifier. There should now be an entry in the Project Store View for your new customization, which is deployed to your server but not yet operational. To make your new modification active, select it and choose Install Project from the File menu. The Project Store View should change to reflect the new status of your modification. The installed column in the Project Store View should read "Yes."

  9. Open the Buyer client again.

  10. Choose the performance view and you will see that the performance points are now filled with more meaningful values. Each of these values is processed by your customization. If you wish to change the scheme used to evaluate performance, you can change the installed project to use a different formula.

For more information on authoring buyer customizations in the Modifier, consult the "Modifier User Guide."