Run OBIEE Agent via Button Event - Part 2

In the Part 1, we have seen how to create Agent Run button.

In this exercise, let us look at one specific requirement.

The Admin should be able to execute the agent from the OBIEE dashboard only when the difference between the Next Run Date of the agent being selected from the dashboard prompt and current sysdate is no more than 15 days.

Let us start our exercise.

In the last exercise we say 3 agents. Go and edit their Schedule Time/Frequency.

Please note that you must first build a small subject area using scheduler tables in OBIEE.
The detailed document can be found in Oracle support. ( DOC ID - 1227908.1)

In my case I have it in my OBIEE application so I am just extending it to suit my needs.
It is called Scheduler Jobs.

From this Scheduler Jobs SA,

Pull Agent Name, Agent Path and Next Run Time column in the report.

On top of it, we shall add two calculated columns.

One is sysdate or current date and another is difference between next run date and sysdate.

See below snaps.

Here is the output. Look at the Difference Column. 

In the above snapshot, look at the next run time. I have in the beginning of this exercise changed the schedule times of those 3 agents that we saw in the Part 1.

We shall be using the report Agent - ConditionToDisplay in another report as a filter.

Let us see.

Create one more report using Scheduler Jobs SA.

Take Agent Path column and make it IS PROMPTED.

Take one more column. Any column. Go to its column formula and write 

cast (15 as double)

Look here.CODE column---> 

Now look here carefully, we shall be using the report Agent - ConditionToDisplay as a filter
condition report.


In the same report, edit the No Data view as shown below. This report name is Checks.


Now Go to Dashboard editor.

Repeat the same exercise.

Add Variable Prompt in 1st section.

Add Static Text with JS code in the 2nd section.

In the 2nd section condition, select Checks Report and condition is rowcount is not equal to zero.

Done. Save changes and Run the dashboard. 

Read the No Data message. It is designed as per the requirement.

Please once scroll up and see the output of Agents- ConditionToDisplay report.

The Difference column value of AgentSimple is 210. That is more than 15.

Hence when you select this agent from the prompt in this dashboard, you should not be able to execute it. 

Let us see.

See below 2 agents. User can execute them as the difference count is less than 15.


Now look at AgentSimple. 

Yes so we are unable to execute it from this dashboard page as the difference between the next run date of this agent and today's sysdate of the machine is more than 15 days.

Thank you.