PreviousNextIndex

FILL function

Generates a character string made up of a character string that is repeated a specified number of times.

Syntax

FILL ( expression , repeats ) 

expression
repeats
Example

This example procedure produces a bar chart that depicts each Customer’s balance as a percentage of the total of all outstanding balances. The first FOR EACH block accumulates the value of balance for each Customer, producing a total balance value for all Customers. The next FOR EACH block goes through the Customer table again, figuring each Customer’s balance as a percentage of the total.

r-fill.p
DEFINE VARIABLE fillchar AS CHARACTER NO-UNDO FORMAT "x" INITIAL "*". 
DEFINE VARIABLE percentg AS INTEGER   NO-UNDO FORMAT ">>9". 
FOR EACH Customer NO-LOCK: 
  ACCUMULATE Customer.Balance (TOTAL). 
END. 
DISPLAY "Percentage of Outstanding Balance" WITH CENTERED NO-BOX. 
FOR EACH Customer NO-LOCK WHERE Customer.Balance > 0: 
  percentg = Customer.Balance / (ACCUM TOTAL Customer.Balance) * 100. 
  FORM SKIP Customer.Name percentg LABEL "%" bar AS CHARACTER 
    LABEL "  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17" 
    FORMAT "x(50)" WITH NO-BOX NO-UNDERLINE USE-TEXT. 
  COLOR DISPLAY BRIGHT-RED bar. 
  DISPLAY Customer.Name percentg FILL(fillchar,percentg * 3) @ bar. 
END. 

The FORM statement describes the frame layout, including the name, the percentage of total balance, and a bar across the top of the frame. (The bar variable is defined on-the-fly; it has no corresponding DEFINE VARIABLE statement at the top of the procedure. It is defined in the FORM statement and has its own label and format.) The DISPLAY statement following the FORM statement displays the bar variable. If the procedure is running on UNIX or on a monochrome PC monitor, the AVM ignores the COLOR BRIGHT-RED. However, if the procedure is running on a PC with a color monitor, the bar is displayed in BRIGHT-RED (a predefined color on the PC). The final DISPLAY statement displays the bars.

The fillchar assignment statement sets the fill character to asterisk (*). The FILL function generates a string made up of fill characters that is the percentage of total sales multiplied by three (each percentage point uses three fill characters).


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex