Tuesday 28 January 2014

How to add hyper link to Apex Report

Assume we have a student details DB table having necessary student details including a column having home page link of individual students if they have one. Student details needs to be displayed in an apex report. If a student has a home page then it should be displayed as a hyper link in the report else cell should be blank.

EP_STUDENT_DETAILS Table structure

When adding the select query to pull the data for your Apex Report you have to add a case statement as given below. Which would check if the link column is empty, if not will generate a html hyper link tag and place the Home page link value for the href attribute



select "EP_STUDENT_DETAILS"."STUDENT_ID" as "STUDENT_ID",
"EP_STUDENT_DETAILS"."NAME" as "NAME",
"EP_STUDENT_DETAILS"."AGE" as "AGE",
         CASE WHEN "HOME_PAGE" IS NOT NULL THEN '<a href="'||HOME_PAGE||'">Home Page</a>' END AS "Home Page"
 from "EP_STUDENT_DETAILS" "EP_STUDENT_DETAILS"


HOME_PAGE : This is the column in the EP_STUDENT_DETAILS table have the URL for the home pages.

No comments:

Post a Comment