Example: Copy one Column into Another Column with Transform

In this example we will use the Transform panel to copy the contents of one column in a table into another column, but only for selected records.  We will use the Products table from the Nwind example data set.   

 

eg_trnsfd01_01.png

 

Open the Products table and Ctrl-click the row handles for two records to select those records.   The Units On Order value for both of the selected records is 0.

 

eg_trnsfd01_02.png

 

In the Contents pane choose the Transform panel.  Choose the Units On Order field as the target field.   Choose the Copy template and then choose the Units In Stock field as the Value field.

 

eg_trnsfd01_03.png

 

As soon as we choose the Copy template and the Units In Stock field as the Value field, the Transform panel will preview what it is about to do in the table, showing affected records in blue preview color.

 

eg_trnsfd01_04.png

 

We click the Restrict to selection box and then we choose Units In Stock in the Value box.   We are telling Manifold to copy into the Units On Order field the values from the Units In Stock field and to do that only for the selected records.  

 

eg_trnsfd01_05.png

 

The copy command is previewed in the table by showing that the values for the Units On Order, if we commit the changes, will be changed from 0 for each field to 39 and 53 respectively.   The preview uses a blended color that is a mix of blue preview color and red selection color.

 

eg_trnsfd01_06.png

 

We press the Update Field button to commit the changes.

 

eg_trnsfd01_07.png

 

The Products table now shows the new values for the Units On Order field for the selected records.

 

Notes

In the example above, for the Value box we chose a field from the pull-down menu of fields in the table.   If we prefer, we can enter a fixed number or an SQL expression into the Value box.

 

eg_trnsfd01_08.png

 

For example, suppose we would like to copy into Units On Order a value that is half as many units as are in the Units In Stock field.   We can choose the Expression setting for the Value box and then enter the expression

 

[Units In Stock] / 2

 

into the Value box.   When using the Units In Stock field name in an expression, we must put square brackets around the name of the Units In Stock field to avoid ambiguity caused by the spaces in the field name.

 

eg_trnsfd01_09.png

 

The template previews the results using a blended color that is a mix of blue preview color and red selection color.  Previews are just previews intending to show which records are affected.  They are not final, precise calculations.  In the above illustration we see that the Units On Order values that will be altered are shown as decimal fractional values even though the Units On Order field is an integer field.  

eg_trnsfd01_10.png

 

If we commit the transform by pressing the Update Field button, the actual divide by 2 result will be rounded to the correct integer value.

 

This example continues in the Example: Transform Field Values using an Expression in the Transform Panel topic.

See Also

Selection

 

Contents Pane

 

Contents - Select

 

Contents - Transform

 

Transform Options

 

Command Window

 

Queries

 

Transform Templates

 

Transform Templates - Boolean

 

Transform Templates - Datetime

 

Transform Templates - Geom

 

Transform Templates - Numeric

 

Transform Templates - Text

 

Example: Two Drawings from the Same Table - Take a table with a geom field that is visualized by a drawing.  Add a second geom field to the table and create an rtree index on that field so it can be visualized by a drawing.   Copy the first drawing, paste it and adjust the pasted copy so it uses the second geom field.

 

Example: Transform Field Values using an Expression in the Transform Panel - How the Expressions tab of the Transform panel may be used to change the values of fields.  

 

Example: Construct JSON String using Select and Transform - Use the Select panel and the Transform panel to manually construct a JSON string using values from other fields in a table. Shows how we can manipulate text to build desired contents in a field.

 

Example: Transfer Options and Merge Areas - Using the Merge Areas Transform panel template, an exploration of the difference between using Copy and Sum for transfer options.

 

Example: Use a Transform Expression to Create Buffers in a Drawing - Use the Expression tab of the  Transform panel to create three different sizes of buffers for different lines in a drawing and then automatically create a query which does the same thing.  Includes examples of using the Add Component button and also the Edit Query button.

 

Example: Transfer Options and Merge Areas - Using the Merge Areas Transform panel template, an exploration of the difference between using Copy and Sum for transfer options.

 

Example: Transform Templates, Expressions and Queries - We learn to use a function by clicking on a template in the Transform panel, seeing what it does in a preview, looking at the query Manifold creates and then trying out the function in the Expression tab.