Automate DataLink Process

3.26K viewsGeneral Discussion
0

Hello Guys

First of all thank you very much for all the favors. With your help I am able to make a simple plugin application “Hello World”.

Now I want to shift my track that leads to my goal. Actually I want to use Quantrix in my application. I want to populate quantrix from my database application.

My first step is to Automate Data Link process. From my database application I will select the SQL Server Data base table and I want to see this table in Quantrix as we do in DataLink.
It means my database application will populate the quantrix.

Can I have any good suggestions before start.
Can I call some pre-written functions that quantrix calls in DataLink Process.
Can some one guid me?

Thanks
Abrar

0

Dear Pete

You are great … you are really great. I have downloaded this attachment and with a little modifications in ODBC connection I have managed to run it. Now I can populate Quantrix Model with my own Database Queries. So the DataLink Automation is done. Thanks to you and your company.

Now my new task is to export the data from quantrix. I have already managed to export CSV/XLS format files.

—————————————————
Model model=arg0.getModel();
String path= “C:/abrar.xls”;
model.exportModelTo(path,QuantrixConstants.cExportExcel,true );
—————————————————-

But I dont want to export to CSV/XLS I want to directly write back to database usign ODBC Connection.
Can you help me in this matter? Can you send me sample code for this as well.

Thanks and Regards
Abrar

0

Just as a quick follow up – if you are looking to export this plugin make sure that in the ‘plugin.xml’ file the ‘build’ tab has the ‘jtds-1.2.jar’ file checked in the binary build section.

-Mike

0

Great Abrar,

Attached to this post is a zipped “archive” of a demonstration plugin sample. This should give you a source of inspiration on how to implement an automatic data-import feature. Look closely at the SimpleOLAPLoader class which demonstrates how to configure a basic OLAP import from a result-set.

To import this code into your eclipse setup, perform the following steps from within Eclipse:

1) File -> Import…
2) Select Existing Projects into Workspace
3) Select “Select archive file:” radio button
3) Browse to the SimpleOLAPDemo.zip that you downloaded from this post
4) Ensure that the com.quantrix.plugin.demp.olap project is selected.
5) Click Finish

This should open the project in your Eclipse workspace. If you have the workspace configured for Quantrix plugins, everything should work.

The demo is hard-wired for demonstration purposes only to query against the Northwind database that comes with SQLServer. You will need to modify the code in SimpleOLAPAction.java to point to your database instance of Northwind.

IMPORTANT NOTE: this sample plugin includes the jTDS JDBC driver for SQLServer. This is the driver we recommend as it is free and seems to perform well. See [url:8mm8rv0b]http://jtds.sourceforge.net/[/url:8mm8rv0b] for licensing information.

Feel free to post again if you have further questions!

Cheers,

pete

0

Dear Peter

Thank you very much for you help.Your answer is absoultely perfect (on target ) But I want in more details.You described two following methods

—————————————————
1) You can create a table in the model using the Model.createMatrix() and manually build the matrix to receive the data. Then you could iterate over the cells in the matrix and pull the data from the ResultSet into the matrix using a CellCursor.

2) You can implement the IDataGrid interface wrapping your ResultSet and pass that to the Model.importData() method which takes an IDataGrid and a Map defining all of the parameters necessary to do either a two dimensional import or an OLAP import.
——————————————————

In my case I am using MS SQL Server and my application decides on run time that which database to be used and which table to be populated in quantrix.

Can you let me know which method of the perfect on and easy as well to implement. Can you give me some code samples.

Thanks and Regards

Abrar

0

Greetings GreatAbrar,

Based on your posting I’m not sure I fully understand what you are trying to accomplish. However, here are two possible approaches to importing data into a Quantrix model through the QAPI. Assuming you have an IAction that connects to your database and performs a query using JDBC:

1) You can create a table in the model using the Model.createMatrix() and manually build the matrix to receive the data. Then you could iterate over the cells in the matrix and pull the data from the ResultSet into the matrix using a CellCursor.

2) You can implement the IDataGrid interface wrapping your ResultSet and pass that to the Model.importData() method which takes an IDataGrid and a Map defining all of the parameters necessary to do either a two dimensional import or an OLAP import.

#2 is essentially like executing the DataLink wizard but through the QAPI. Configuration of the Map is a bit tricky and will take a careful reading of the ImportMapKeys and some experimentation to figure out the right configuration for your needs.

Does that answer your question?

Cheers,

pete
peter m. murray