A - Import

Prev Next

Overview

B4P provides various means to download files, load data from different sources.

The Internet contains rich information sources which could be useful for data processing needs. Only two function calls are needed to retrieve tables from the web:


Example with Country Table from Wikipedia

Simple Example
  file download overwrite        ( "https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes", ISO_Codes.html );
  table load                     ( countries, ISO_Codes.html, HTML, Current ISO 3166 country codes);

  table list( countries, briefly, 5, 1st col, 0, last col, 1 ); // List first and last 5 rows and 2 columns only
Original table as retrieved from Wikipedia
    0 : ISO 3166[1] name[5]  | World Factbook[6] official state name[a]  
    1 :                      |                                           
    2 :  Afghanistan         | Islamic Republic of Afghanistan           
    3 :  Åland Islands       | Åland                                     
    4 :  Albania             | Republic of Albania                       
    5 :  Algeria             | People's Democratic Republic of Algeria   
  ... :
  268 :  Wallis and Futuna   | Territory of the Wallis and Futuna Islands
  269 :  Western Sahara [aj] | Sahrawi Arab Democratic Republic          
  270 :  Yemen               | Republic of Yemen                         
  271 :  Zambia              | Republic of Zambia                        
  272 :  Zimbabwe            | Republic of Zimbabwe                      

Try it yourself: Open GUI_Features_Import_source_data.b4p in B4P_Examples.zip. Decompress before use.

You may notice the following:

  • The header row is not in the top.
  • Various fields contain references to further literature, e.g. [a], [aa], etc.
  • Note the missing space in the entry for Western Saharah. An exotic UNICODE 'hair space' symbol exists inside.

For these reasons above, some initial cleanups are needed which are described on the next page.