Topics
See More

How to Invoke Oracle BI Publisher Reports with Parameters using Python

This article makes the assumption that the reader has some basic knowledge related to Oracle BI Publisher like creating data models and reports, running reports and extracting files.

How-to-Invoke-Oracle-BI-Publisher-Reports-with-Parameters-using_Python

It is simple and straightforward to run/schedule a BI Publisher (BIP) report that has no parameters but what if a BI Publisher report has been created with different type of parameters like lists of values (LOV’s), dates or text?   Can such BIP reports be scheduled using the standard scheduling interface?  The answer is ‘no’ because there is no way to provide input parameter values.

How to Invoke Oracle BI Publisher Reports with Parameters using Python

Additionally, extracting data from BIP reports with parameters is extremely difficult and complex as it takes an increasing level of effort based on number of parameters and their inputs (like LOV’s/dates).

Thankfully, there is a way to schedule BIP reports that have parameters and to easily extract data from such reports.  We do this by making use of Oracle BI Publisher SOAP Web Services and Python.

Oracle-BI-Publisher-SOAP-Web-Services-and-Python

Login to Oracle BI Cloud using login method in Security Service:

Login-to-Oracle-BI-Cloud

Get the definition of the report by using getReportDefinitionInSession method in Report Service:

getReportDefinitionInSession-method-in-Report-Service

Get the parameter names and LOV values of the report using getReportParametersInSession.

Extract the parameter names and LOV values to a list or dictionary to iterate over all the values and make a list with every combination of inputs.

LOV-values-to-a-list-or-dictionary

Use itertools module to iterate over a dictionary of lists to get every combination of inputs.

If we want to get a date list for any date parameter we can use the following:

get-a-date-list-for-any-date-parameter

Once we have a list with all possible combinations, iterate over the list to generate the parameters dictionary as below and run the report for that combination and export to respective output files.

Sample parameter dictionary:

Append all the generated parameter dictionaries to a list:

parameter-dictionaries-to-a-list

Run the report using runReportInSession method by passing all the required values to it:

Now it is time to extract the data from response and load it to a file.

extract-the-data-from-response-and-load-it-to-a-file

Hurray! Now we have data/file for each combination of our parameter inputs.

Oops, do not forget to logout from the Oracle BI Cloud session:

logout from the Oracle BI Cloud session

Additional information regarding BI Publisher Web Services can be found at the URL below:

https://docs.oracle.com/cd/E28280_01/bi.1111/e22259/webservices.htm#BIPDV002.

As you can see, with a little bit of customization it is possible to schedule BIP reports with parameters and to extract data from such reports in an automated manner.  Please try out this process and give us your feedback.

Apps Associates’ Data and Analytics Practice is a team of 125 highly credential professionals dedicated to helping companies leverage their data assets to become data-driven organizations.