You finished h-BinCheck.p and you already made the change to h-OrderCalcs.p to run it.

To change the window procedure to accept the new OUTPUT parameters and display them:

  1. Add two more fill-in fields to the window and call them cWorstWH and cBestWH.
  2. Give them labels that describe them, such as These warehouses are unable to fill the order and This is the best US warehouse for the order.
  3. Go into their property sheets and make them Enabled but Read-Only, like the other fill-in fields. The default data type for fill-ins is CHARACTER, so you do not need to change that. You can expand the field width to allow more room to display the results.
  4. Change the RUN statement in the VALUE-CHANGED trigger to include the two new OUTPUT parameters to h-OrderCalcs.p, and to display them:
    DO:
      RUN h-OrderCalcs.p
        (INPUT Order.OrderNum,
        OUTPUT dTotalPrice, OUTPUT dTotalExt,
        OUTPUT cWorstWH, OUTPUT cBestWH).
      dAvgDisc = (dTotalPrice - dTotalExt) / dTotalPrice.
      DISPLAY dTotalPrice dTotalExt dAvgDisc cWorstWH cBestWH
        WITH FRAME CustQuery.
    END.
  5. Run the window. You see values for the Warehouses that cannot supply the Items for the Order at all and for the Warehouse that is the best source for most of the Items, if there is one:

The data in the Sports2020 database is not too imaginative, so the Cologne Warehouse is almost always unable to supply Items and the Northeast USA Warehouse is almost always the best one. But the values are recalculated every time you select a different Customer or a different Order.

You learned a great deal about how to construct complex procedures in ABL. Using the principles of block types, data access statements, and record buffer scoping, you can write procedures that express your application’s specialized business logic with a precision and conciseness not possible in any other programming language.