table process, table process rows, table process all rows, table process selected rows, table process all selected rows
These are one of the most powerful functions in the B4P language: The ability to process the contents in tables row-by-row
without formulating loops or complex algorithms. The statements for processing the data in every row are provided
as function parameters and will be executed for every single row selected. Combined with already available table context for partial table specifications,
you can do powerful algorithms with minimum amount of simple code text. See code examples further below.
The all in the function name indicates that row 0 (header row) is to be included for processing.
For consistency with related function names, table process rows has been added and is identical to table process
The closest relative of this function is for all table rows() which describes a loop using loop index
Indirect parameter passing is disabled
This function provides a table context for partial table specifications with table name and row number for selected function parameters
2-4
No. | Type | Description |
---|---|---|
1. input |
string | Name of existing table |
Opt. 2. code |
expression :string |
Expression to select rows Applicable to table process selected rows only: |
2. / 3. code |
statements :string |
Statements (applicable where rows are selected) table process / table process rows: The statements provided will be executed for every row. |
4. code |
statements :string |
Statements (otherwise) table process / table process rows: Not applicable. This function accepts 3 parameters only.
table process selected rows: The statements provided will be executed for every row where the condition calculated before returned false. |
Type | Description |
---|---|
numeral | Number of rows processed With table process selected rows, the number of selected rows (and processed with statements from 3rd function parameter) are counted. With the function table process selected rows, only the processing for 'true' matches are counted. |
table initialize ( animals, { {Animal, Group, Characteristics},
{ parakeet, bird }, { moose, mammal }, { ape, mammal }, { sparrow, bird } , { trout, fish }, { bass, fish },
{ canary, bird }, { penguin, bird }, { beluga, mammal} } );
table process ( animals, [Animal] = ![Animal] ); // Capitalize
table process selected rows ( animals, ([Group] = bird), [Characteristics] = "Can fly", [Characteristics] = "Can't fly" );
table process selected rows ( animals, ([Group] = fish) | ([Animal]=Penguin,Beluga), [Characteristics] = "Can swim" );
table list ( animals );
0 : Animal | Group | Characteristics
1 : Parakeet | bird | Can fly
2 : Moose | mammal | Can't fly
3 : Ape | mammal | Can't fly
4 : Sparrow | bird | Can fly
5 : Trout | fish | Can swim
6 : Bass | fish | Can swim
7 : Canary | bird | Can fly
8 : Penguin | bird | Can swim
9 : Beluga | mammal | Can swim
table process selected rows fast
table process cells
table process cells selected rows
table process columns
table process columns selected rows
table manipulate