Modifying Data Values

Field assignment file expressions are composed using the general format

file.field = expression

The expression can be a simple expression or conditional expression using an if-then-else construction.

Example: Simple Expression

This example assigns a value to the Sample Company Name field, in the business class Sample Company. This type of expression might be used to initialize values in a field, for example.

Field assignment file entry:

SampleCompany.SampleCompanyName = "New Company"

The Sample Company Name field in the target dictionary (New Dictionary) will have the value New Company in each record after the copy is completed.

You can also use mathematical expressions to manipulate the value of the field. For example, if you wanted to change the value of a Sample Value field, you could use an expression such as

SampleCompany.CompanyID = CompanyID + 10

Example: Conditional Expression

Conditional expressions are useful when you want to change the data only when certain circumstances. The expression in the following example changes the company name to New Company when the Company ID is 1234, otherwise the existing value for the Sample Company Name field is passed to the target dictionary.

SampleCompany.SampleCompanyName = 
    if (SampleCompany.CompanyID = 1234)
        "New Company"
    else
        SampleCompanyName

Example: Complex Conditional Expression

The following example illustrates the use of multiple if/else statements to evaluate the number of employees and assign new names based on the size of the company.

SampleCompany.SampleCompanyName =
    if (SampleCompany.NumberEmployees < 1000)
        "Small Company"
    else
    if (SampleCompany.NumberEmployees > 1000 
        && SampleCompany.NumberEmployees < 10000)
        "Medium Company"
    else
        "Large Company"