Config / Mappings / Using the SourceExpr and DestExpr Properties

Using the SourceExpr and DestExpr Properties

In the last section, we’ve discussed how to add table instances to a mapping. In this section, we’ll look at how to access the data of fields in a table. And how to use constant values and filters.

The module allows you to read data from fields from tables, whenever there is a SourceExpr (source expression) property. The SourceExpr can also be used to specify constant values or to call functions. You will find this property on the data lines of mapping of format type NAV and on the data lines of export mappings. But this property is also available for parameters of custom function and to extend error messages. There are more options, which we will discuss a little bit later in this section.

To write data to table fields there is another property called DestExpr (destination expression). This property also allows you to check data against a specified filter, instead of storing it. We will go into the details in a moment. It is important to know that you can write data to any field of a table instance, even if the table Mode is set to Read. Writing to a table in read mode will call the validation logic of NAV, but we don’t modify the record. On our buffer tables you can use this to store a value for a certain time in the mapping. On other tables it will depend on the validation logic, whether it is safe to use a table in read mode to temporarily store data.

The SourceExpr Property

SrcType

The source type specifies what kind of data you want to read. The allowed values are:

Const

A constant value that is entered in the mapping.

Field

A field from a table instance, that is one of the parent mapping lines of this mapping line. In case you want to read a sum field you have to be outside the table instance, but below it.

Function

You want to read data from either a build-in or a custom function.

Data Type

This property was added in Anveo EDI Connect 4.00.

This property is only available if the SrcType is set to Const. This property specifies the data type of the constant value. You have to select the data type, to prevent errors due to different locales used during setup and runtime. In older version you had to ensure that the locale during setup was the same than during runtime to prevent, for example, numbers to be interpreted differently.

You can choose from the following data types:

Text

A constant text value.

Text (Special)

A text that can contain special characters, like a carriage return (<CR>). There is a list of all supported special characters.

Boolean

A boolean value, like True or False.

Option

An option value. You should use the integer value of the option in the database.

Integer

An integer value (32 bit).

Decimal

A decimal value.

BigInteger

A large integer value (64 bit).

Duration

The value contains a duration.

Code

The value is a Dynamics code value (uppercase only, does not allow all characters).

Date

Represents a date value.

Time

Represents a time value.

DateTime

Represents a combined date and time value.

DateFormula

A date formula.

GUID

A global unique ID (GUID).

Value

This property is only available if the SrcType is set to Const. Represents the constant value that you want to use.

Function

This property is only available if the SrcType is set to Function. You can use the AssistEdit to specify the object and function. If the function required parameters, these will be SourceExpr as well, but do not support nesting of functions.

Table

This property is only available if the SrcType is set to Field. Select the table instance to read the data from. The table need to be one of the parents of the current mapping line, to read the data of one record. If you want to read sum fields, you have to be under the table instance, but not a child of it.

Field

This property is only available if the SrcType is set to Field. Selects the column / field you want to read from.

Value Translation

You can specify a value translation, to change the selected value to a different target value. There is a section on how-to setup value translations.

Name

The code of the value translation that should be used.

No Translation Action

What should happen, if the value is not found in the value translation.

Ignore

The module does nothing if the translation is missing. It uses the original value without translation.

Empty

Output an empty value.

Info

Add a information log entry and use the original value.

Warning

Add a warning log entry and use the original value.

Error

Break the mapping immediately and log an error.

Error (Continue)

Create an error log entry and do not successfully finish the mapping, but continue with the processing to find other errors as well.

Advanced Validation

This property is hidden by default. You can specify a list of allowed values and create errors, iof you try to export another value.

Allowed Values

The list of allowed values. You can either use the AssistEdit or enter the terms comma separated.

Not Allowed Action

What should happen, if the source value is not in the list of allowed value.

Ignore

Do not use the advanced validation and ignore any values in the list.

Info

Create a information log entry.

Warning

Create a warning log entry.

Error

Break the mapping immediately with an error message.

Error (Continue)

Return an error on mapping execution, but continue to process the mapping, to find other errors as well.

The DestExpr Property

DestType

Select the target for a value. The following values are valid:

Empty means that the value is ignored. You can use this to skip fields on imports or, for example, to ignore a function return value.

Filter

The value should be checked against a Dynamics filter. If the filter does not match the value is not accepted. Depending on the converter this will result in an error message or in skipping a section of the mapping. You’ll learn more on the use of filters for specific converter on the documentation of each converter.

Field

The value should be written to a field of a table instance in this mapping.

Value

This property is only available if the DestType is set to Filter. The Dynamics filter the value is checked against. The value will be interpreted as a text value for applying the filter. A typical example would be “BY|IV”, to allow the values “BY” and “IV”.

Table

This property is only available if the DestType is set to Field. Selects the table instance the value should be written to. The table instance has to be one of the parents of the current mapping line.

Field

This property is only available if the DestType is set to Field. The field name/column name of the target field on the table.

Validate

This property is only available if the DestType is set to Field. This property is only available as an advanced property. Setting this property to False will skip the Microsoft Dynamics NAV 2016 validation trigger for that field.

Be very cautious when using False. You should only deactivate the validation after consulting a programmer. You should not deactivate it on any of the standard Dynamics tables, except you really know what you are doing. You can make Microsoft Dynamics NAV 2016 unusable, by skipping validation code.

Assignment Mode

This property is only available if the DestType is set to Field and you’re using the NAV converter. You can find more information on the converter page.