How to list all lines in a field with Progress 4GL

Trey

An address field in a Progress database evidently is multiple lines. So if I do something simple like:

for each customer where customer-number = "123" no-lock.

display customer-number
        customer-name
        customer-address.

I get results of:

123  John Smith  123 Easy St.
                 c/o Jane Smith
                 Apartment C12

I want results of:

 123  John Smith  123 Easy St.  c/o Jane Smith  Apartment C12

I've tried Entry - but get an error if an element does not exists. I am trying to export to CSV and want each line to be another column and if a column does not exists then it is blank.

Any help will be MUCH appreciated!

Tom Bascom

If the delimiter is a newline then something like this should work:

define variable n as integer no-undo.
define variable i as integer no-undo.

define variable address as character no-undo.

output to value( "customer.csv").
for each customer no-lock:
  address = "".
  n = num-entries( customer-address, "~n" ).
  do i = 1 to n:
    address = address + entry( i, customer-address, "~n" ) + " ".
  end.
  export delimiter "," customer-number customer-name trim( address ).  
end.
output close.

or, if you just need to change the delimiter within the customer-address field:

output to value( "customer.csv").
for each customer no-lock:
  export delimiter "," customer-number customer-name replace( customer-address, "~n", "," ).  
end.
output close.

(And, actually, my original code is really just replacing ~n with a space so you could do that too...)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to make a multidimensional array in Progress 4GL?

How to store the data in database in chinese language on progress 4gl?

How to converts a character to decimal on progress 4GL?

How do I call the procedure section from window application using asynchronous method on progress 4GL?

How to rethrow caught exception in progress 4gl?

How to export xml file in progress 4gl?

How to send a SOAP headers in Progress 4GL

Progress 4GL: How to generate different log file name when multiple processes using the same Timestamp?

How can I access more than 1 element from a field in Progress 4GL

How to test if string is numeric using Progress 4GL

Datatype in progress 4gl

In progress 4gl get field names of temp-table

How can i get the same result in Progress 4gl?

List methods or procedures (with arguments) in compiled Progress 4gl class

progress 4gl query for export count of records in all table available in db

Progress 4GL: How to find where a procedure is defined

How to match a records in progress 4GL?

How to calculate yesterday records with today records using progress 4gl?

How do I count total lines and create new/Select sheet in one csv file using progress 4GL?

How to implement NOT EXISTS in OPEN QUERY statement in PROGRESS 4GL - OpenEdge 10.2A

Update data field in progress 4gl

How to fix Dynamic Query error for progress 4gl?

How fast can a file be written/read by progress 4GL program?

How to get the last comma separated data stored in a variable? - Progress 4gl

How add only required fields from table to dynamic temp table? - PROGRESS 4GL

How to hide form fields data? - PROGRESS 4GL?

how to add and display specific records from code_mstr to temp-table in progress 4gl?

how to create a temp-table for code_mstr in progress 4gl?

how to apply last key from a program itself without requiring a user input? - PROGRESS 4GL