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!
The result is a full blown schema in the designer with access to all tables, all child tables and all foreign keys:
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.
/*------------------------------------------------------------------------ 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
Thomas Wurl, the CEO and Head of Development of Taste IT Consulting, is a Progress specialist and has a profound history with its projects. For 8 years, he worked as a consultant for Progress Software GmbH in Cologne and for the Progress Software Corporation at its American headquarters. As Progress Certified Solution Designer who has 25 years of experience with Progress, Thomas realizes projects on all orders of magnitude for a wide variety of industry sectors.