table integrate smart, table integrate smart ignore case
This function combines the lookup strategy from table lookup smart() with the data integration features of table integrate().
Indirect parameter passing is disabled
6 - 9 (For parameter description and return values: see table integrate() )
table initialize( lookup,
{ { Names, Sports, Scores },
{ Abel, 't*', 10 }, { Bea, 's*', 14 },
{ Chuck, 'r*', 13 }, { Dan, 't*', 8 },
{ Eva, '*sh', 9 }, { Finn, 't*', 12 },
{ Gini, '*ball', 12 }, { Hugo, 's*', 11 }, { All others, '*', 0 } } );
table initialize( target, {{ Sport, Name, Score 1, Score 2, Score 3, Score 4 },
{ racquetball, "", 5, 100, 12 },
{ squash, "", 5, 100, 12 }, // Lookup table: Squash entry is below racquetball
{ racquetball, "", 5, 300, 10 },
{ football, "", 1, 300, 20 },
{ tennis, "", 5, 100, 12 } } );
// Picks the 1st match and integrates the results
count[] = table integrate smart ( target, Sport, { Name, Score 1 .. Score 4 },
lookup, Sports, { Names, 4:Scores }, { overwrite, add, sub, max, average }, true, Counter );
echo("Lookup table after lookup:");
table list ( lookup );
echo("Target table after lookup (", count[], " items found):");
table list ( target );
Lookup table after lookup:
0 : Names | Sports | Scores | Counter
1 : Abel | t* | 10 | 1
2 : Bea | s* | 14 | 1
3 : Chuck | r* | 13 | 2
4 : Dan | t* | 8 |
5 : Eva | *sh | 9 |
6 : Finn | t* | 12 |
7 : Gini | *ball | 12 | 1
8 : Hugo | s* | 11 |
9 : All others | * | 0 |
Target table after lookup (5 items found):
0 : Sport | Name | Score 1 | Score 2 | Score 3 | Score 4
1 : racquetball | Chuck | 18 | 87 | 13 | 6.5
2 : squash | Bea | 19 | 86 | 14 | 7
3 : racquetball | Chuck | 18 | 287 | 13 | 6.5
4 : football | Gini | 13 | 288 | 20 | 6
5 : tennis | Abel | 15 | 90 | 12 | 5
table integrate with rules
table integrate smart once
table integrate
table lookup smart
table expand smart
table digest smart