Feedback

  • Contents
 

Define a Destination Field Value Using C# Script

Use the Define Destination Field Value dialog box to use C# script to process values in the source field before storing them in the destination field.

To define a destination field value using C# script

  1. In the Navigation pane, click Clients.

Clients pane

  1. In the Clients pane, expand the appropriate folder and then double-click the client. The tab for the specified client appears in the Information pane.

General tab

  1. Click the Import Files tab and then click the New Business, Financial Transactions, Maintenance, or Final Recall tab, depending on the import file type.

Import Files tab

  1. Click Modify File Mapping. The Data Translator window appears.

Data Translator window

  1. Click the Mapping tab.

Data Translator window

  1.  In the Destination pane, double-click a mapped destination field. The Define Destination Field Value dialog box appears.

Define Destination Field Value dialog box

  1. Click Script. The C# Script tab appears.

  1. Type the C# script to use to check values, parse data, or perform any other function on the source field before populating the destination field. For example, the following script removes dashes from the data:

using System;

using System.Globalization;

public class Script : Scripter.DefaultScriptBase

{

    public Script()

    }

    public override string GetScriptValue(string str1)

    {

        return str1.Replace("-","");

    }

    public override string GetScriptValue(string str1, string str2)

    {

        throw new ApplicationException("Script method not implemented yet");

    }

    public override string GetScriptValue(string str1, string str2, string str3)

    {

        throw new ApplicationException("Script method not implemented yet");

    }

    public override string GetScriptValue(string[] args)

    {

        throw new ApplicationException("Script method not implemented yet");

    }

}

Note: The first line ALWAYS contains "public class Script : Scripter.ScriptBase" to implement the three methods indicated. If C# code is referencing the Latitude file number field, return a -1 for an empty string. Otherwise, the number increments by one until the C# script returns a new number.

  1. Click OK.

  2. In the menu bar, click Advanced and then click Save Mapping Definition. The Save As dialog box appears.

  3. In the File name box, type a name for the file and then click Save.

Related Topics

Map Source Fields to Destination Fields

Destination Fields

Import File Mapping