Search Results for

    Show / Hide Table of Contents

    Conversions

    • What are conversions?
    • How do I create a conversion card?
    • What are the three types of conversions?
    • What are the product-specific source code tags?
    • What is the further information about field conversion?
    Tip

    Summary: This chapter explains how to create a conversion card in the COSMO Data Integration Framework. It also provides an overview of the product-specific source code tags and considerations for storing global conversions.

    Conversions provide the ability to change values based on fixed rules. They can be stored globally for a Mapping Version or attached to each field individually. For a detailed description of applying a conversion to a value, see Value Classes and Field Values.

    To create a conversion card

    1. Choose the Lightbulb that opens the Tell Me feature icon, enter Conversions - Data Integration Framework, and then choose the related link.
    2. Choose the Edit action to open an existing card.

    There are three types of Conversions that are determined in the Type field on the Lines FastTab:

    • Fixed Value - Converts everything to the Fixed Value field, regardless of the received value.
    • Value Table - For this type, choose the Show Value Table action on the Manage menu of the Lines FastTab to open the relevant value table and store a From-Value To-Value Conversion.
      If Type = Value Table, the If Value Not Exist field becomes editable. The options are:
      • Use Unconverted Value – Value is maintained; default option.
      • Blank Value – Result of the Conversion is equal to Blank.
    • Source Code - Indicates a conversion within a piece of source code. Additional Source Code Tags can be managed by the OnBeforeConvertValueByTag() event of Codeunit 5100918, DIS - Conversion Mgt.

    A Conversion is only valid if the conditions in the Repository List and Repository Field fields match the current action. However, there is a related field origin only for Value Class = Record Pool. For all other Value Classes (see Value Classes and Field Values), a conversion line is only valid when both fields are empty.

    Product-specific source code tags

    The source code tags specific to COSMO Data Integration Framework are described in the following table:

    Source code tag Description
    BASE2BYTES Converts a Base64 text into a DotNet byte-array. Used for import from an XML file into a BLOB field, for example.
    BC2DATETIME/NAV2DATETIME Converts a Microsoft Dynamics 365 Business Central Date or Time value into a combined DateTime value.
    BYTES2BASE Converts a DotNet byte-array into a Base63 text. Therefore, a binary field can be saved into an XML node.
    FORMAT Executes a common Microsoft Dynamics 365 Business Central Format on the value. For example, it shows the textual value of an option field (Order instead of 1 for the Document Type field in the Sales Header table).
    FORMATXML Converts the value into XML format. Executes a common Microsoft Dynamics 365 Business Central Format with property 9 on the value.
    XML2DATE Converts an XML text value into a Microsoft Dynamics 365 Business Central date. Therefore, the textual value must be from format XML, like <Year>-<Month>-<Day>.
    XML2DECIMAL Converts an XML text value into a decimal. Therefore, the textual value must be from format XML, with a dot (.) as decimal separator.
    XML2RECID Converts an XML text value into a Microsoft Dynamics 365 Business Central RecordID. Therefore, the textual value must be from format XML.
    XMLXPATH Converts an XML text value into a valid XPath expression.
    COPYSTR Copies a string from a given value. You can use it by entering [Textvalue],[Startposition],[Length] (e.g., MyValue,3,2). Note that you must enter a start and a length value. If you want to copy the whole string after the start, use 0 for the length.
    BCCALCDATE Calculates a date value based on a Date Expression and a Date. Example <3W>,[Workdate]. Use the English value of the calculation formula with <> enclosed to avoid errors by using another language.
    BCCREATEDATETIME Calculates a DateTime value based on a date and a Time field. For example, [Workdate],[Time]
    ROUND Rounds a decimal value with format [DecimalValue];[Length];[Direction]. The Length defines the rounding precision (e.g., 0,1 for one decimal, 1 for whole numbers). Directions: > (round up), < (round down), = (truncate). Example: 356.549;0,1;> → 356.6
    DELCHR Deletes specific characters from a text value. Format: [TextValue],[Where],[Which]. Where can be < (leading), > (trailing), or = (all). Which defines the characters to remove. Example: '-ABC-,=,-' → ABC
    DATETIME2TIMESTAMP Converts a Microsoft Dynamics 365 Business Central DateTime value into a Unix timestamp (seconds since 01-01-1970). Adjusts for the specified time zone and daylight saving time. Accepts Date, Time, or DateTime values. Example: '2023-11-14T22:13:20' → 1700000000
    TIMESTAMPTODATETIME Converts a Unix timestamp (seconds since 01-01-1970) into a DateTime value in Microsoft Dynamics 365 Business Central. Accepts integers, big integers, or text representations of a timestamp. Example: 1700000000 → 2023-11-14T22:13:20
    URLENCODE Encodes a text value into a valid URL format by converting special characters (e.g., space → %20). Useful for constructing web requests or API calls. Example: 'Hello World!' → 'Hello%20World%21'

    Further information

    For field conversion with Value Class = Record Pool, the table and field name of a Conversion Line is searched first. If no field name can be found, then the table name is used for the setting. If no table name can be found, a search is performed for a line without a table and field name.

    Note

    If a conversion is stored global for a Mapping Version, and for this a conversion line exists without table and field name, then theoretically each value at every point of the Mapping is converted during the entire process. Therefore, take care when using global conversions.

    See Also

    Export and Import Conversions


    Feedback
    Submit feedback for this page .

    In This Article
    Back to top 2025 © COSMO CONSULT - Data protection - Imprint