Progress OpenEdge Reporting Tool List & Label 21

This time we feature a guest post from our partner and developer colleague Thomas Wurl. About two years ago, Thomas developed a free data provider for Progress OpenEdge available for all List & Label customers. While this provider was adopted successfully by many Progress users, it suffered some restrictions. So Thomas decided to restart from scratch and came up with an incredibly fast and powerful new solution. Here's his story. 
In 2014 I came up with the first version of the List & Label Data Provider for OpenEdge. This data provider was a hybrid of C# and ABL code and due to its ABL part only runnable within ABL sessions. Technically this solution was ok, but too slow because of the required .NET – ABL bridge calls for each record and each column value.  And the bad thing is – there is nothing you can do about it!
So the idea was born to write another one in pure C#, communication with OpenEdge via JSON, AppServer aware, service-oriented almost generic backend, tools to generate schemas for the services and – first of all – fast!
A hard decision!  I had to start from scratch, learn JSON and dive quite deep into C#. Another challenge was the OpenEdge generic backend stuff. But here it is!
Openedge data provider for reporting tool version 21

The data provider acts as a data source for List & Label. The first thing the provider does is to ask the service for its schema. Based on the schema the provider creates instances for the classes “Table”, “Table Row”, “Table Column” and “Table Relation”. This is the first thing List & Label asks for when you call methods like Design() or Print().
The result is a full blown schema in the designer with access to all tables, all child tables and all foreign keys:
Openedge data provider for reporting tool version 21

The provider supports advanced sorting and advanced filtering including multi-value filters. You can add foreign keys of a table row in any depth and even multiple instances of the same foreign key table but different children. Foreign keys are retrieved together with the table in a single service hit. The service sends only columns being used in the layout and columns building the used relations. Sorting is also done by the service.

Using the provider is quite easy. You need to define your services. If you want generic access to your entire database, create a service class similar to the Sports2000 demo service.  All you have to do is to register all of your database tables and to define relations. The music plays in the generic OpenEdge Service  class you inherit from.

 

/*------------------------------------------------------------------------
File : Sports2000Service
----------------------------------------------------------------------*/
USING Progress.Lang.*.
USING ListLabel.OpenEdgeAdapter.OpenEdgeService.
USING ListLabel.OpenEdgeAdapter.OpenEdgeSchema FROM PROPATH.

BLOCK-LEVEL ON ERROR UNDO, THROW.

CLASS ListLabelDemo.Sports2000Service INHERITS OpenEdgeService:

CONSTRUCTOR PUBLIC Sports2000Service ( ):
SUPER ().
END CONSTRUCTOR.

METHOD OVERRIDE PUBLIC VOID registerSchema( ):
ServiceSchema:DatabaseName = "sports2000".
FOR EACH sports2000._file WHERE _file._hidden = FALSE NO-LOCK:
ServiceSchema:registerFile(_file._file-name).
END.

{ListLabelDemo/sports2000_relations.i}

/* Optional Views for large schemas */
ServiceSchema:registerView("OrderView","Order,OrderLine",2).

RETURN.
END METHOD.

END CLASS.

Relations are registered similar to files in the include file. An included relation generator tool helps you to get this done – at least a first shot.

 

/* Customer */
ServiceSchema:registerFileRelation("Customer","BillTo","CustNum,CustNum","Customer_BillTo"). /* Indexes: Customer.Customer <->> BillTo.custnumbillto */
ServiceSchema:registerFileRelation("Customer","Invoice","CustNum,CustNum","Customer_Invoice"). /* Indexes: Customer.Customer <->> Invoice.CustNum */
ServiceSchema:registerFileRelation("Customer","Order","CustNum,CustNum","Customer_Order"). /* Indexes: Customer.Customer <->> Order.CustOrder */
ServiceSchema:registerFileRelation("Customer","RefCall","CustNum,CustNum","Customer_RefCall"). /* Indexes: Customer.Customer <->> RefCall.CustNum */
ServiceSchema:registerFileRelation("Customer","ShipTo","CustNum,CustNum","Customer_ShipTo"). /* Indexes: Customer.Customer <->> ShipTo.custnumshipto */

Service is done. Ready to rumble!

USING TasteITConsulting.ListLabel21.OpenEdgeDataProvider FROM ASSEMBLY.
USING combit.ListLabel21.ListLabel FROM ASSEMBLY.
USING ListLabelDemo.Sports2000ServiceAdapter FROM PROPATH.

DEFINE VARIABLE oProvider AS OpenEdgeDataProvider NO-UNDO.
DEFINE VARIABLE oLL AS ListLabel NO-UNDO.
DEFINE VARIABLE oServiceAdapter AS Sports2000ServiceAdapter NO-UNDO.

oProvider = NEW OpenEdgeDataProvider().
oServiceAdapter = NEW Sports2000ServiceAdapter().
oLL = NEW ListLabel().

/* Get the schema */
oProvider:ServiceAdapter = oServiceAdapter.
oProvider:ServiceName = "ListLabelDemo.Sports2000Service".
oProvider:ViewName = "OrderView".
oProvider:Initialize().

/* Attach the data provider */
oLL:DataSource = oProvider.
oLL:ForceSingleThread = TRUE. /* :-( */

/* Limit rows for designer preview. */
oProvider:MaxRows = 50.

/* Action! */
oLL:Design().
oLL:Dispose().

If you want to give it a try then download the free trial of List & Label. Before trying to build your own service please read the documentation and then play around with the demo application. Both – the documentation and demo are included in the trial installation at ..\Samples\Progress\OpenEdge\. For a deeper look into this .NET data provider have a look at its project on GitHub.

Everything has been built with List & Label 21, Open Edge 11.6 64 bit and Visual Studio Community 2015. .NET Framework 4 is required.

If you don’t have the above yet, please use the following links for download:

•    https://www.combit.net/trial/ 
•    https://www.progress.com/openedge/classroom-edition

If you’re working with really huge databases, you might also want to check out the latest performance optimizations for the Designer

Related Posts

Leave a Comment