Here I am giving an example to highlight data when it meets certain criteria in oracle apex report.
Step 1: Create a new blank page.
Step 2: Function Call: Create a function get_data_highlighter. If you want to render it in multiple places, it would be good practice to put this code in a package and call it in your query.
Sample function in a package called FXGN_GENERAL
create or replace FUNCTION get_data_highlighter(
p_value IN NUMBER)
RETURN VARCHAR2
IS
l_return VARCHAR2 (4000);
BEGIN
IF p_value >= 95 THEN -- Very Strong
l_return := '<span class="t-Badge t-Badge--basic t-Badge--small is-success w100p">Very Strong</span>';
elsif p_value >= 66 THEN -- Strong
l_return := '<span class="t-Badge t-Badge--basic t-Badge--small is-success w100p">Strong</span>';
elsif p_value >= 33 THEN -- Moderate
l_return := '<span class="t-Badge t-Badge--basic t-Badge--small is-warning w100p">Moderate</span>';
elsif p_value >= 10 THEN -- Weak
l_return := '<span class="t-Badge t-Badge--basic t-Badge--small is-danger w100p">Weak</span>';
ELSE -- Very Weak
l_return := '<span class="t-Badge t-Badge--basic t-Badge--small is-danger w100p">Very Weak</span>';
END IF;
RETURN l_return;
END;
Step 3: Create a new classical report or interactive report (whichever you want), then your query would then look something like this,
SELECT fund_id,
fund_name,
to_char(start_date, 'DD-Mon-RRRR') start_date,
fxgn_general.get_data_highlighter(growth) growth
FROM fxgn_fund_progress
ORDER BY fund_id ASC;
Step 4: Go to report attribute growth and set Escape special characters = Yes
Output: Then your output would then look like this,
Happy APEXing!!!...
Comments
Post a Comment