Development Tips

Logi Tutorial: How to Use Data Layer Plugins to Call Custom Data Sources

By Natan Cohen
Share on LinkedIn Tweet about this on Twitter Share on Facebook

Logi supports a variety of data sources out of the box, including relational databases, analytic sources, NoSQL databases, Hadoop, web applications, and others. This means that for the majority of use cases, Logi customers are able to embed analytics seamlessly into their applications with Logi’s predefined data connectors.

>> Related: Mastering Plugins –  3 Ways to Extend Your Analytics <<

But what happens if you want to retrieve data from sources that are not directly supported by out-of-the-box Logi elements? At Logi, we give you the option to extend our platform and connect to custom data sources using plugins.

Data Layer Plugins to the Rescue!

Plugins give you the ability to programmatically extend the functionality of your Logi applications. Plugins are basically pieces of code written in .NET or Java and embedded in a Logi project.

There are various plugin hooks in the report process (at load time, during data manipulation, or at the end). Through plugins, you can dynamically access Logi Info parameters, definitions, data, and runtime values.

There are three types of plugin elements related to data layers:

  • Data Layer Plugin: Retrieves data from data sources not supported by Logi. The plugin is called when data layers are normally run, for example whenever the report definition is loaded or refreshed.
  • Data Layer Call Plugin: This allows you to manipulate the data once it’s pulled in.
  • Finish Data: This plugin is called when all the data layers have been run and you can view and manipulate the resulting data.


How do I use a plugin to make a call to a custom data source such as MS Access Database?

In this tutorial, we will show you how to make a call to an MS Access Database or any other custom data source.

Step 1: Write Your Code

When your plugin has been written and compiled, add the element(s) you need to call it in your Logi application (as outlined below).

The first time you run your Logi application, IIS will load the plugin into memory and it will remain cached there. If you make coding changes to the plugin and want to rebuild it, you’ll need to run stop and restart IIS (run iisreset.exe) first, in order to be able to replace the previous build.

Step 2: Add a DataLayer.Plugin element to the report definition

Step 3: Specify Assembly name, which is the DLL of the Filename (.Net only). For Java plugins, instead of specifying the physical path to the JAR file, specify the full package name and class name.

Step 4: Specify Class Type Name (.Net only).  Leave this attribute blank for Java plugins.

Step 5: Specify Method: Name of the plugin Method to be called

Step 6: Specify ID: Unique element ID

Step 7: Pass Data As: Specify how data is returned from plugin to data layer

Note: Default value is XmlDocument. When it’s set to XmlDocument (the default value), the data will be passed to the Data Layer as an XML document object in memory and added to the “ReturnedData” property of rdServerObjects.

Step 8: Click Plugin Parameters


Step 9: Specify the parameters (in this case, one parameter: the data table).

On the Visual Studio side, the code looks like:


NOTE: Every project in Logi has a Bin directory and an rdPlugin DLL (.Net only). In your code you must reference the rdPlugin DLL and utilize the rdServerObjects class, which allows you to communicate with Logi and make calls in and out of Logi. For Java plugins, you should add an external reference to PluginCaller.jar and utilize the LogiPluginObjects10 class, which is located in your Logi application’s WEB-INF/lib directory.

The code extracts parameters from the rdServerObjects class that is coming from the rdPlugin DLL (.Net only).  For Java plugins, you should add a reference to PluginCaller.jar and use the LogiPluginObjects10 class.

The code will loop through the MSAccess data and generate an XML of the data rows. Logi will now have the XML response data and the data can be used for any chart or report which needs it.

Find more tutorials and Logi hacks in the Best Practices Series >


Originally published October 12, 2017

About the Author

Natan Cohen is the Director of Solutions Delivery at Logi Analytics. He's been with Logi for over 13 years and has helped create some of our customers' most successful analytic applications.