Unofficial Content

Note: this feature has been deprecated. Read section 'Availability' below for more information.

The idea behind the Data Provider Generator, as suggested by its name, is the automatic generation of Data Providers by taking data sets from different sources.

Every time a system is developed, usually there is an existing set of tables with relatively general basic data or data that has already been loaded to another system. We mean, for example, the Countries, Units of Measurement and Currencies tables, among many others that may also be created. When implementing the system, a recurring problem is how to solve the loading of data to these tables, when having users enter them through the corresponding transaction doesn't seem to be the most efficient solution. This is the reason why the Data Provider Generator has been implemented. This tool is capable of receiving input from FreeBase and automatically generating the Data Provider that loads them.

The figure below shows the general architecture:

DPGArquitectura


FreeBase is a structured data repository (a sort of Wikipedia, only that it contains data), according to its own introduction: ‘Freebase is an open, shared database of the world's knowledge’.

Data is organized in Domains, Types, Properties and Topics, and an API is provided to obtain these data.

In it we can find information about countries, world currencies, car makes, units of measurement and a lot more.

Below is an example of how to use the Data Provider Generator with input data from FreeBase.

Scenario: Loading of Countries table

In this example, suppose that we have a system with an empty countries table, which has to be populated upon implementing the system. As we said before, we don't want to have a user manually load the data.

 

Therefore, the Data Provider Generator will be used, so that it gets input data from FreeBase to generate a Data Provider that can be used to load the countries' data in every system implementation.

Suppose that we have the following Countries transaction:

CountryId *                  (Autonumber)
CountryName
CountryISOAlfaCode

This transaction is set as Business Component and a basic (no collection) SDT is created, as follows:

CountryName
CountryISOAlfaCode

That is to say, as a Country item without the Id (because it is autonumbered).

Next, we access the Data Provider Generator and in FreeBase we search for the types containing the word Country.

DPGSearch

As we can see in the image there are several types related to Country in the data source, so we keep searching for the one containing the data we need. The FreeBase data source sorts them by relevance and in this case the first Type is the one we are looking for.

After selecting it and clicking on Next, a screen is displayed for us to select the output (1), which in this case is the Country SDT that was defined to this end; the name of the Data Provider to be generated and the KB folder where it will be created (2). It also shows a preview of the data that will be provided by the selected source (3) and the various properties of this source (4).

Finally, this screen displays the Data Provider structure to load the selected SDT (5) (Data Provider item template).

DPGSelectSDT

There, we only have to define the mapping between the SDT items and their available properties, by clicking on the right side of each SDT element assignment ("<Click here to select a property>") and choosing the desired property.

DPGTemplate

Upon completing this action it automatically generates the Data Provider that will load the desired tables through the BC. This Data Provider's output will be the chosen SDT, with the Collection property set to True and the Data Provider's name as the collection name.

DPGOutput

Lastly, we only have to write the following load procedure.

for &SDTCountryItem in SDTCountryLoader()
     &Country = new()
     &Country.CountryName        = &SDTCountryItem.CountryName     
     &Country.CountryISOAlfaCode = &SDTCountryItem.CountryISOAlfaCode     
     &Country.Save()     
endfor 
commit

Availability

This feature has been discontinued in GeneXus X Evolution 2 Upgrade 3 and is deprecated in all versions since the API is was based on has been changed by its provider


Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant