table replace cells, table replace cells seleted rows, table replace cells in columns, table replace cells selected rows in columns
This function looks for cells using the right-hand comparison expression across all or selected columns and across all or selected rows. Once found, the cell will be replaced with new contents.
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
3-6
No. | Type | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1. input |
string | target table name The target table must exist. | ||||||||||||||||||||||||||||||
Opt. 2. code |
expression :string |
Expression to select rows Applicable to table replace cells selected rows and table replace cells selected rows in columns: | ||||||||||||||||||||||||||||||
Opt 2. / 3. input |
table columns | Header names and/or column numbers See table columns as function parameters for general ruling for this parameter.
| ||||||||||||||||||||||||||||||
2 / 3 / 4 input |
string set |
values to compare Provide one string or multiple strings in a set to compare with the table contents. wildcards are supported if the strings are of type softquoted string. | ||||||||||||||||||||||||||||||
3 / 4 / 5 input |
string set |
new values Provide one string or multiple strings in a set to replace the table contents if the corresponding comparisons apply. wildcards are supported if the strings are of type softquoted string. The nuber of set elements must match, unless one single value is provided here which will then be applied for all successful comparisons. | ||||||||||||||||||||||||||||||
Opt. 4 / 5 / 6 input |
string set |
options One or multiple options may be applied.
Notes: |
Type | Description |
---|---|
numeral | Number of replacements made All fields which have been replaced successfully are counted. Matches with replacements to be done outside the table will not be counted. |
table initialize( t,
{ { City, State, Country },
{ Tuscon, AZ, United States },
{ Toronto, ON, Canada },
{ Missisauga, ON, Canada },
{ Zürich, ZH, Switzerland },
{ Lake Zurich, MI, United States } } );
table copy table ( t, u );
c[] = table replace cells( u, { United States, canada, 'swit*' }, { US, CA, CH }, ignore case );
table replace cells in columns( t, City, '*Zurich*', Fake Place, { 3:right } );
table list ( u );
echo("Number of replacements in first function call ", c[], new line );
table replace cells selected rows in columns( t, [Country]==Canada, State, ON, Ontario, once );
table replace cells in columns ( t, Country, { United States, Canada }, { US, CA }, once each );
table replace cells( t, US, ' (near California)', append );
table list ( t );
0 : City | State | Country
1 : Tuscon | AZ | US
2 : Toronto | ON | CA
3 : Missisauga | ON | CA
4 : Zürich | ZH | CH
5 : Lake Zurich | MI | US
Number of replacements in first function call 5
0 : City | State | Country |
1 : Tuscon | AZ | US (near California) |
2 : Toronto | Ontario | CA |
3 : Missisauga | ON | Canada |
4 : Zürich | ZH | Switzerland |
5 : Lake Zurich | MI | United States | Fake Place