table expand smart ...

Prev Next

Function Names

table expand smart, table expand smart ignore case

Description

This function combines the lookup strategy from table lookup smart() with the data integration features of table expand().

Call as: procedure or function

Restrictions

Indirect parameter passing is disabled

Parameter count

6 - 9 (For parameter description and return values: see table expand() )

Examples

  table load( lookup, "Examples/Table Lookup Example 2.csv" );
  table delete remaining rows ( lookup, -2 ); // Remove last 2 rows (the mom's place and 'not found' row)

  table initialize( target, { Seating, inside, balcony, outside, bar } );

  echo("Target table before lookup:");
  table list( target );

  count[] = table expand smart ignore case
        ( target,   Seating, {Place to go, Table size},
          lookup, Ambience, {Restaurant Name, Table size}, {}, true, Counter );

  echo("Lookup table:");
  table list( lookup );

  echo("Target table after lookup (", count[], " items found):");
  table list( target );

Output

Target table before lookup:
    0 : Seating
    1 : inside
    2 : balcony
    3 : outside
    4 : bar    

Lookup table:
    0 : Offering           | Table size | Ambience               | Restaurant Name       | Phone Number   | Counter
    1 : *Chicken*          | 2,4,6      | inside,bar             | Rôtisserie de Paris   | (212) 555-1234 | 2      
    2 : *Curry*            | 1..10      | "self-service"         | Bharat take-away      | (212) 555-2345 |        
    3 : *Pizza*,*Pasta*    | 4,6,8      | inside,outside         | Luigis                | (212) 555-3456 | 2      
    4 : *Beer*,*Wine*      | *          | bar                    | Luigis                | (212) 555-3456 | 1      
    5 : *Pizza*,*sea*food* | *          | inside,outside         | All-Italian Trattoria | (212) 555-4567 | 2      
    6 : *Fish*,*sea*food*  | 2..8       | outside                | Wharf Place           | (212) 555-5678 | 1      
    7 : *Burger*,Fries     | 1..20      | =inside,"self-service" | Mr. Burgermeister     | (212) 555-6789 | 1      

Target table after lookup (9 items found):
    0 : Seating | Place to go           | Table size
    1 : inside  | Rôtisserie de Paris   | 2,4,6     
    2 : inside  | Luigis                | 4,6,8     
    3 : inside  | All-Italian Trattoria | *         
    4 : inside  | Mr. Burgermeister     | 1..20     
    5 : balcony |                       |           
    6 : outside | Luigis                | 4,6,8     
    7 : outside | All-Italian Trattoria | *         
    8 : outside | Wharf Place           | 2..8      
    9 : bar     | Rôtisserie de Paris   | 2,4,6     
   10 : bar     | Luigis                | *         

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

See also

table expand
table expand fast smart
table expand with rules
table lookup smart
table integrate smart
table digest smart