Expression Generator

The Expression Generator lets you build an expression to use when mapping a target field. It can also be used from the Global Script Editor and the Replication Script Editor to help write scripts to use during replication. Expressions can be written using Visual Basic (the default) or C# by setting the scripting language in the Global Script Editor, accessible from the right mouse button menu on the metadata.

Using the Expression Generator for Mapping Target Fields

You can map a target field to a source field or an expression when setting up your replication. Only fields that are mapped will be replicated.

You might want to map a target field to an expression when the source table does not contain a column that exactly matches the data you want to see in the target column. For example, in a source table where FirstName and LastName are two separate columns, but in the target table, there is a single column, Name, that should contain both the FirstName and LastName values. Use an expression to concatenate values from the two columns.

Either type in your expression or navigate through the trees to build your expression.  

The functions and operators available in the Expression Builder are those typically available for most .NET providers. If you are not sure what functions and operators to use, check your .NET provider documentation.  If you use a function or operator that is not supported by your .NET provider, the mapping will fail during replication. Syniti DR additionally provides some predefined values that help you to define an expression quickly.

Using the Expression Generator to Help Write Scripts

In both the Global Script Editor and the Replication Script Editor, the Expression Generator button opens the Expression Generator so that you can use it to find functions and operators to use in the scripts. You can build parts of the script using the Expression Generator. Then, when you close it, the information is displayed in the Script Editor.

Using the Expression Generator for Defining a Refresh Filter

The Replication Properties dialog offers an option to define a filter for Refresh replications. The WHERE condition (on either source or target table) applies during refresh applications to filter the records that are replicated. Click to open the Expression Generator and write an expression to apply during the refresh replication. The expression can contain SQL and/or functions available for your RDBMS.

Opening the Expression Generator

To write an expression to use when mapping fields from source to target tables:

  • In the Replication wizard Mapping info screen, click Define Mapping and choose Map to Expression.to open the Expression Generator.

  • On the Replication Properties dialog General tab, click Mapping to open the  Fields Mapping dialog. Click Define Mapping and choose Map to Expression.to open the Expression Generator.

To write an expression to use as part of a replication script:

To write an expression to use as part of a global script:

  • In the Management Center Metadata Explorer, select the metadata for which you would like to write a script.

  • From the right mouse button menu, choose Global Script.  

  • In the Global Script Editor, click .

To write an expression to use as a Refresh filter: