This post demonstrate the steps to display image based on the column value in the table with Interactive Report in Oracle APEX.
Simple Report:
Instead of Patient Risk value we need to get as shown below
Steps: 1 I have created a table as shown below.
CREATE TABLE "DEMO_PATIENT"
(
"PATIENT_ID" NUMBER(5,0) NOT NULL ENABLE,
"PATIENT_NAME" VARCHAR2(50) NOT NULL ENABLE,
"PATIENT_RISK" VARCHAR2(10) NOT NULL ENABLE,
CONSTRAINT "DEMO_PATIENT_PK" PRIMARY KEY ("PATIENT_ID")ENABLE
)
/
"PATIENT_NAME" VARCHAR2(50) NOT NULL ENABLE,
"PATIENT_RISK" VARCHAR2(10) NOT NULL ENABLE,
CONSTRAINT "DEMO_PATIENT_PK" PRIMARY KEY ("PATIENT_ID")ENABLE
)
/
In Above table Patient_Risk column can contain only two possible values. 1. High 2. Low
So based on these values we will show images.
Step2: Create a Report in your APEX Application
Step3: Type following query to get data.
Step4: Hide icon and icon_color columns
Step5: Go to Patient_Risk Column properties and set following value under HTML Expression.
<span class="#ICON#" style="color: #ICON_COLOR#"></span>
=======================================================
Change the query as shown below
Now hide risk_icon and risk_color column as we have done in last example.
Now select patient_Risk column and apply following code under HTML Expression
Output will look like
Have a Happy Learning
Regards
Digvijaysinh Virpura