Build your First Report with MaxPrint

Build your First Report with MaxPrint

This article explains how to build a simple report using the MaxPrint Oracle APEX plugin. To use the plugin in your Oracle APEX Application, you first need to download the plugin, install it within your application and then use it.

Environment: Oracle APEX 20.1

  1. How to Download the plugin?
  • Get the installation files here:

After your purchase, you will receive an email with a link to installation packages. Click that link to download the plugin.

  • Unzip the installation folder named: plugin.zip

Here are the content of the unzipped installation folder:

  1. Installation process

Follow the below steps to Run the install.sql script in the Oracle APEX workspace script command.

  • Log into your Oracle APEX Workspace and select the application you are working on.

Run the uploaded script: Once the script has been is uploaded, you can run it. See the picture below.

You will get the below result

Import MaxPrint plugin file(dynamic_action_plugin_com_maxprint.sql)

In your installation folder, let’s import the file dynamic_action_plugin_com_maxprint.sql as a plug-in in APEX.

  • Go into your application and click on the Export/Import button

On the next page, click on the Import button

Import the file named: dynamic_action_plugin_com_maxprint.sql from the installation folder

Enter the following information :

Parameters Value
HTTP Link  https://app.maxprint.io/api 
API Key  $2a$16$9SKi35ksuFrbCcSTf.VGIu0zsQzl5dpZvMGaks5AH3YodspJp1.jq

 

And then click on Apply Changes.

Now you have successfully installed MaxPrint Plugin. Let now try to print a report

  1. Create your first report

You must first design your report on a Windows document based on the information you want to display.

NB: you must have a schema with some tables on which you want to display a report. In our case, we have the below schema table objects and would like to print an order detail.

  • DEMO_ORDER_ITEMS
  • DEMO_PRODUCT_INFO
  • DEMO_ORDERS
  • DEMO_CUSTOMERS

    Report template language

  • Keywords:
  • Report: use this tag to start and end your template region.  The start tag is {#report} and the end tag is {/report}.
  • Details: use this tag to start and end query tuple for a single SQL. This tag is only used when your report query is simple SQL.  The open tag is {#details} and the close tag is {/details}
  • Query cursor name Tag: if your report query used a cursor, the cursor name is a start and end tag in your template. For example, if I have a cursor named: employee, I will have an open tag name {#employee} and a close tag name {/employee} in the template, to list all employees.
  • pageBreakExceptLast: Break the report page over the query row.
  • Label: you can enter any words anywhere in your template. It will be displayed as it is.
  • Column name: your query column name.
  • Image: you can add any picture like your company logo to your template.

Generate a Report Template

  • You can build your template form from scratch

Example of template

Open a docx file and create your template. When you are done, save your template on your computer and follow the below steps to upload the document to your Oracle APEX Workspace.

  • Inside your Oracle Application
  • Go to the shared component
  • Under the Files section, Select Static Application Files
  • Click on Upload file and then upload your saved Docx template
  • Copy your document name

  • Or you generate a template from your query
  • Create a MaxPrint Dynamic Action on a button
  • Select: generate template on the setting action
  • Run your APEX page and click on the button to generate the template

Here is what we will have:

You can now modify the template the make it look nicer by adding your logo, color, and organizing label position. When your template is ready, upload it in Oracle APEX to be used to generate future reports.

Print Action :

We can run a report in different ways.

  • Onload process
  • On button click

In this case, we are going to run the report when a user clicks on a button.

Within a page in your application, create a button and add a dynamic action to it.  Create a true action with the below setting:

  • Action: MaxPrint[Plug-In]
  • Setting Action: Generate Report
  • Template Source: APEX Static Files Directory
  • Template File Name : OrderTemplate.docx
  • Template File Type: Docx
  • Data Source Type: SQL Query
  • SQL Type: Simple SQL
  • Query: Enter your query here.

MaxPrint supports three types of SQL queries

  • Simple SQL
    • Cursor based SQL
    • JSON Object SQL

Below is an example of a simple SQL query for the MaxPrint plugin.

  • Master Query Columns: List all query Columns.
  • Items to submit: if you query to use an Item, enter the item name here. In our case, the query uses the order ID item (P29_ORDER_ID) which contains the order ID we want to print. We must submit this item in the APEX session to be accessed by the query on the server side. That is the reason why, we have it in the items to submit.
  • Output Type: pdf
  • Output Filename: the output filename. Enter any name.
  • Output Method: open in a web browser.

Execution

We have the below result when we click on the print button:

Leave a Comment

Your email address will not be published. Required fields are marked *

Table of Contents

Scroll to Top