transformations:updatedb
Differences
This shows you the differences between two versions of the page.
Next revisionBoth sides next revision | |||
transformations:updatedb [2020/07/06 06:57] – created dmitry | transformations:updatedb [2021/07/27 01:23] – craigt | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Update database table ===== | + | {{ transformations: |
+ | ====== | ||
+ | Category: Workflow / External\\ | ||
- | This action updates | + | \\ |
+ | =====Description===== | ||
+ | This action updates | ||
+ | |||
+ | \\ | ||
+ | =====Action settings===== | ||
+ | ^ Setting | ||
+ | |Connector< | ||
+ | < | ||
+ | \\ | ||
+ | ====Update settings==== | ||
+ | ^Setting ^Description ^ | ||
+ | |Table name< | ||
+ | |Update rows where these columns match|Select the database field and the EasyMorph dataset column containing matching values.| | ||
+ | |Column mapping|Select the EasyMorph dataset column containing the updated values, and the database field to be updated. | | ||
+ | \\ | ||
+ | ====Options settings==== | ||
+ | ^Setting ^Description ^ | ||
+ | |When value doesn' | ||
+ | |Empty value handling|Choose how EasyMorph will handle empty values in the (source) dataset table. | ||
+ | \\ | ||
+ | ====Custom SQL settings==== | ||
+ | ^Setting ^Description ^ | ||
+ | |Execute custom SQL before updating|Check this option to run a custom SQL statement prior to the final update of the database table. | ||
+ | |||
+ | \\ | ||
+ | =====Remarks===== | ||
+ | Note that each combination of values in matched key columns in EasyMorph | ||
+ | |||
+ | For instance, this is correct because every value in [Marital Status] (key field) corresponds to only one value in [NewMaritalStatus]: | ||
+ | ^MaritalStatus ^NewMaritalStatus ^ | ||
+ | |M |Married | ||
+ | |S |Single | ||
+ | |||
+ | The following is incorrect and will make the action fail: | ||
+ | ^MaritalStatus ^NewMaritalStatus ^ | ||
+ | |M |Married | ||
+ | |S |Single | ||
+ | |S |Also single | ||
+ | |||
+ | \\ \\ | ||
+ | It’s also possible to not specify matching key fields at all. In this case, the EasyMorph dataset must have only one row and the underlying SQL UPDATE statement will look as follows: | ||
+ | UPDATE | ||
+ | SET db_field1 | ||
+ | ; | ||
+ | |||
+ | If no matching fields are specified and the EasyMorph dataset has more than one row, the action will fail. | ||
+ | |||
+ | \\ | ||
+ | =====Examples===== | ||
+ | **Example: | ||
+ | |||
+ | **Database table: | ||
+ | ^BusinessEntity | ||
+ | | 3| 2|Engineering | ||
+ | | 219| 4|Document Coordinator | ||
+ | | 241| 2|Accounts Manager | ||
+ | | 244| 3|Accounts Receivable | ||
+ | | 246| 3|Accounts Payable | ||
+ | | 248| 3|Accountant | ||
+ | |||
+ | **EasyMorph dataset: | ||
+ | ^MaritalStatus ^NewMaritalStatus ^ | ||
+ | |M |Married | ||
+ | |S |Single | ||
+ | \\ | ||
+ | **Parameter settings: | ||
+ | > Connector is (connector to the target database) | ||
+ | > Table name is " | ||
+ | > Database field is " | ||
+ | > Column or value is " | ||
+ | > This table is " | ||
+ | > Database is " | ||
+ | \\ | ||
+ | **Database table after update:** | ||
+ | ^BusinessEntity | ||
+ | | 3| 2|Engineering | ||
+ | | 219| 4|Document Coordinator | ||
+ | | 241| 2|Accounts Manager | ||
+ | | 244| 3|Accounts Receivable | ||
+ | | 246| 3|Accounts Payable | ||
+ | | 248| 3|Accountant | ||
+ | |||
+ | \\ | ||
+ | =====See also===== | ||
+ | * [[transformations: | ||
+ | * [[transformations: | ||
+ | * [[transformations: | ||
+ | * [[https:// | ||
- | For a detailed explanation see [[https:// |
transformations/updatedb.txt · Last modified: 2023/10/15 21:05 by craigt