Search code examples
openedgeprogress-4gl

Is it possible to use the DELIMITER statement when using the DISPLAY statement


Let's say I wanted to do a FOR EACH of 3 tables/fields:

slmast.name slmast.acode slmast.address.

Usually, they are presented neatly with nothing separating them.

However, would I also be able to use the DELIMITER statement to separate them, or add commas/ speech marks?

For example:

 FOR EACH slmast.

 DISPLAY (DELIMITER) "," slmast.name slmast.acode slmast.address

Solution

  • No, DELIMITER is not an option for DISPLAY.

    You could do as Mike suggests and build a string with SUBSTITUTE or you could add the desired commas like so:

    for each slmast no-lock:
    
      display 
        name + "," format "x(30)"
        acode + ","
        address + "," format "x(30)"
      .
    
    end.
    

    This will make nice columns if that's what you want whereas Mike's code will eliminate spaces - which, alternatively, might be what you want.

    You need the FORMAT phrase if the width will exceed the default format of 8. I left acode unadorned to show the default.