Search code examples
oracleoracle11goracle-apex

How do I display a new line within column data in an Apex Interactive Report


I'm using Apex 4.2 and Oracle 11.g

I have a column called "Transaction Detail" that I display in an interactive report. The report column's Display Text As selection is set to "Standard Report Column". The report column is selected from a varchar2 table column called transaction_detail. I'm just building the table as well. The transaction_detail table column is populated from a Procedure with the following code:

Insert into mail_log (transaction_type, transaction_detail)
Values ('FTP Transaction',
           'Filename=' || p_image_filename || 
                '<br/>' || 'Event Description=' || l_event_description);

The procedure code can be easily changed. The report just displays:

Filename=myfile.jpg<br/>Event Description=my description

I've tried using CHR(13) in the procedure instead of the html characters and then tried to replace the CHR(13) in apex with html characters. Instead of simply selecting the column:

  , transaction_detail

I tried:

 , REPLACE(transaction_detail, CHR(13), '&lt;br/&gt;')

but I couldn't get past an Apex error: ORA-12899: value too large for column "APEX_040200"."WWV_FLOW_WORKSHEET_COLUMNS"."DB_COLUMN_NAME" (actual: 49, maximum: 30)

Shouldn't Apex be able to interpret the
as a new line if the column is a Standard Report Column?


Solution

  • This was answered on the OTN forum by Jorge (jrimblas) and others. The link to that discussion is above. Short summary, In the stored procedure I got rid of the '&lt;br/&gt;' and replaced it with CHR(13). Then, in the Apex interactive report, I did NOT need to change the column to "Standard Report Column". I placed the following in the "HTML expression" for the column.

    <div style="width:240px">
    <pre style="font-family:Arial; font-size:12px; white-space:pre-wrap">#TRANSACTION_DETAIL#</pre>
    </div>