15.6 ADD_HIGHLIGHT Procedure

This procedure adds a highlight to the highlight collection. Highlight collections can be passed to the EXPORT calls in order to highlight a row or a column in a row. If no highlight collection (or an empty highlight collection) is passed, no highlights render in the export.

This procedure requires a highlight column. The value is the ID when highlights should be applied, else NULL.

Syntax

PROCEDURE ADD_HIGHLIGHT (
  p_highlights        IN OUT NOCOPY t_highlights,
  p_id                IN            pls_integer,
  p_value_column      IN            apex_exec.t_column_name,
  p_display_column    IN            apex_exec.t_column_name DEFAULT NULL,
  p_text_color        IN            t_color                 DEFAULT NULL,
  p_background_color  IN            t_color                 DEFAULT NULL );

Parameters

Parameter Description
p_highlights Highlight collection.
p_id ID of the highlight.
p_value_column Name of the column where to check for the highlight ID.
p_display_column Name of the column where to display the highlight. Leave empty for row highlights.
p_text_color Hex color code of the text (#FF0000).
p_background_color Hex color code of the background (#FF0000).

Examples

DECLARE
    l_highlights     apex_data_export.t_highlights;
    l_context        apex_exec.t_context;
    l_export         apex_data_export.t_export;
BEGIN
    apex_data_export.add_highlight(
        p_highlights          => l_highlights,
        p_id                  => 1,
        p_value_column        => 'HIGHLIGHT1',
        p_display_column      => 'SAL',
        p_text_color          => '#FF0000' );

    l_context := apex_exec.open_query_context(
        p_location    => apex_exec.c_location_local_db,
        p_sql_query   => 'select empno, 
                                ename, 
                                sal,
                                case when sal >= 3000 then 1 end as HIGHLIGHT1
                            from emp' );

    l_export := apex_data_export.export (
                        p_context      => l_context,
                        p_format       => apex_data_export.c_format_pdf,
                        p_highlights   => l_highlights );

    apex_exec.close( l_context );

    apex_data_export.download( p_export => l_export );

EXCEPTION
    when others THEN
        apex_exec.close( l_context );
        raise;
END;