Try OpenEdge Now
skip to main content
ABL Essentials
Using Basic ABL Constructs : Changing labels and formats

Changing labels and formats

The default label for the Order Number field is Order Num (you define default labels in the Data Dictionary when you set up your database), and you might prefer that it just say Order. Also, the default display format for the ShipDate field is different from the format for the OrderDate field: one has a four-digit year and the other a two-digit year. You can change labels and default formats in your DISPLAY statement. If you add the LABEL keyword or the FORMAT keyword after the field name, followed by a string for the value you'd prefer, then the display changes accordingly.
To make such changes to your test procedure, change the OrderNum LABEL to Order and the ShipDate FORMAT to 99/99/99.
In the following example, each field has its own line in the code block, to make the code easier to read, and to emphasize that this style of coding does not change how the procedure works. Everything up to the period is one ABL statement:
FOR EACH Customer NO-LOCK WHERE Customer.State = "NH" BY Customer.City:
  DISPLAY Customer.CustNum Customer.Name Customer.City.
  FOR EACH Order OF Customer NO-LOCK:
      Order.OrderNum LABEL "Order"
      Order.ShipDate FORMAT "99/99/99" WITH CENTERED.
To view the results of these changes, run your test procedure again: