Search code examples
openedgeprogress-db

LPAD is not working in progress 4gl


I am tring to use lpad in progress Db but its not working.. Code:

lpad(act_num, 7, '#')

This code not working , Do we have any alternative way to achieve o/p. If act_num is 101 then o/P shoud br 7777101.


Solution

  • There is no lpad() function in OpenEdge, but you may be able to use the FILL() function. It takes two inputs: a character string to use as the fill value, and the number of times to repeat the string.

    This will add four "7"s to the beginning of act_num, as you described in your question:

    DEFINE VARIABLE act_num AS CHARACTER NO-UNDO INITIAL "101".
    
    act_num = FILL("7", 4) + act_num.
    
    MESSAGE act_num VIEW-AS ALERT-BOX.
    

    The fill value can be any string, and not just a single character.