Football Club Merger - Program

Prev Next

Merging two footbal teams - Done in one step

The following code examples shows how the two soccer clubs are merged with a handful of statements.

The Full Program
include ( Style Library );      // Include this library if you want to use the 'table style ...' functions.
    table load excel file       ( football club, "Examples\Football Membership List.xlsx" );
    table load                  ( soccer club,   "Examples\Soccer Membership List.csv" ); // Beginners are Novices here

    table rename column headers ( football club, { Family Name, City }, { Last Name, Town } );
    table process selected rows ( soccer club,   [Level]==Novice, [Level]=Beginner );
    table merge                 ( football club, soccer club, { Last Name, First Name }, { Level, Town }, append, " or " );
    table sort rows             ( soccer club,   { Level, Last Name,  First Name });
    table rearrange columns     ( soccer club,   { Level, First Name, Last Name, Town } );


    // Done processing.  Before saving to Excel fie, do some formatting.

    table style theme           ( soccer club, Zebra );
    table style auto width      ( soccer club );
    table process selected rows ( soccer club, ([Level] = '*Questionable*'),
        table style cells           ( soccer club, Level, row(), single, text color, red ) );


    // Save the work as HTML and Excel

    translate style attributes for html (soccer club);
    table save                  ( soccer club, "Images\New Soccer Club Membership List.html", HTML );

    table save excel file       ( soccer club, Soccer Club, "Images\New Soccer Club Membership List.xlsx" );
    table list                  ( soccer club );
    echo ("New soccer club has ", table length( soccer club ), " members. Enjoy playing.");
The Output
    Saved table(s) to EXCEL file 'Images\New Soccer Club Membership List.xlsx' containing 1 sheets.

    0 : Level                       | First Name | Last Name  | Town                
    1 : Beginner                    | Abel       | Amberstone | Amsterdam           
    2 : Beginner                    | Corinne    | Carlson    | Copenhagen          
    3 : Beginner                    | Dietmar    | Davis      | Dublin              
    4 : Beginner                    | Ellen      | Evans      | Essen               
    5 : Beginner                    | Ida        | Ingelberg  | Ingolstadt          
    6 : Beginner                    | John       | Janssen    | Johannesburg        
    7 : Beginner                    | Linda      | Lee        | London              
    8 : Beginner                    | Petra      | Paulsson   | Phoenix             
    9 : Beginner                    | Quincy     | Quarles    | Quebec City         
   10 : Beginner                    | Victor     | Viking     | Venice              
   11 : Experienced                 | Beata      | Berghill   | Barcelona           
   12 : Experienced                 | Fred       | Fisher     | Frankfurt           
   13 : Experienced                 | Gregory    | Green      | Gaza City           
   14 : Experienced                 | Henry      | Hansson    | Hamburg             
   15 : Experienced                 | Mike       | Miller     | Morristown          
   16 : Experienced                 | Nathali    | Nguyen     | New York            
   17 : Experienced                 | Oscar      | Oliveiro   | Oslo                
   18 : Experienced                 | Richard    | Richardson | Riga                
   19 : Experienced                 | Sandra     | Stewart    | San Diego           
   20 : Experienced                 | Tim        | Turner     | Tahoma              
   21 : Questionable                | Uwe        | Ufford     | Ulm                 
   22 : Questionable or Experienced | Karl       | Karlsson   | Kyoto or Kansas City

New soccer club has 23 members. Enjoy playing.
Try it yourself: Open GUI_Features_Example__Merge_football_clubs.b4p in B4P_Examples.zip. Decompress before use.

View the generated Excel and HTML files with the formatting included:

Test Click on the file name open the file with Excel (.xlsx) :
New Soccer Club Membership List.xlsx, and
New Soccer Club Membership List.html.