table integrate smart once, table integrate smart once ignore case
This function combines the lookup strategy from table lookup smart once() 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 once ( 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 | 1
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 | 1
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 | Gini | 17 | 288 | 12 | 6
4 : football | All others | 1 | 300 | 20 | 0
5 : tennis | Abel | 15 | 90 | 12 | 5
table integrate smart
table integrate once
table integrate
table lookup smart once