Config / Advanced Topics / Build-in Functions

Build-in Functions

Anveo EDI Connect has a lot of build in functions. Most of them are available in all mappings, some of them are mapping specific. You can use functions, for example, on source expressions and on conditionals. The build-in functions can be selected like any other function that is defined in the ANVEDI Callback codeunit.

The following functions are globally available:

TableName

COUNT

Returns the count of record inside the filter.

ISEMPTY

Returns True, if there is no record inside the filter. In other words, the count is equal to zero.

TRANSMISSION

TESTFLAG

Whether the current transmission is flagged as test.

DATABASE

COMMIT

This function is dangerous. Please use this function only if you know what you are doing and it is absolutely necessary.

Commits the current database transaction and return always true. Using this function can break the error logging functionality of the mapping and can result in unwanted data in the database.

SYSTEM

WORKDATE

Returns the current work date of Microsoft Dynamics 365 Business Central.

TODAY

Returns today’s date.

TIME

Returns the current time.

CURRENTDATETIME

Returns the current date/time.

CREATEDATETIME

Returns a combined date/time information from two separate values.

Date

The date part

Time

The time part

CALCDATE

Returns a calculated date. Please see Microsoft Dynamics 365 Business Central development guide for more details.

DateExpression

The calculation expression.

Date

The date on which the calculation is based on.

FORMAT

Calls the Microsoft Dynamics 365 Business Central internal “FORMAT” function. Please see Microsoft Dynamics 365 Business Central development guide for more details.

Value

The source value.

Length

The maximal length.

FormatStr/Number

The format string or format number.

COPYSTR

Gets a substring of the input. Calls the Microsoft Dynamics 365 Business Central internal “COPYSTR” function. Please see Microsoft Dynamics 365 Business Central development guide for more details.

String

The input string.

Position

The start position. The first character is indexed with 1. If the position is higher than the input string length an empty string is returned.

Length

The count of characters that should be returned. If the input is too short the substring from position to the end of the string is returned.

STRLEN

Return the count of characters of the input string.

String

The input string whose length is returned.

STRCONCAT

Concatenates all strings that are passed to this function. This function is special as you do not have to use all parameters. If you don’t configure a parameter, it will not be used.

String 1

The input string.

String 2

The input string.

String 3

The input string.

String 4

The input string.

String 5

The input string.

DELCHR

Removes characters from an input. Calls the Microsoft Dynamics 365 Business Central internal “DELCHR” function. Please see Microsoft Dynamics 365 Business Central development guide for more details.

String

The input string.

Where

You can specify where you want to delete data:

<

At the begin of the string

”>”

At the end of the string

=

At any position

Which

The characters to be deleted. If this parameter is empty the module will remove spaces.

CONVERTSTR

Changes the input chaarcters to the output characters. Calls the Microsoft Dynamics 365 Business Central internal “CONVERTSTR” function. Please see Microsoft Dynamics 365 Business Central development guide for more details.

String

The input string.

FromCharacters

The input characters as a string, wihout any delimiters.

ToCharacters

The target characters. This string has to be the same length as the input characters and specifies the replacement for the input string at the same position.

PADSTR

Pads a string to the given length. The text is left aligned. The converter output options give you more control and are preferred over this function. Calls the Microsoft Dynamics 365 Business Central internal “PADSTR” function. Please see Microsoft Dynamics 365 Business Central development guide for more details.

String

The input string.

Length

The target string length.

PadCharacter

The charcter used to pad the string.

INCSTR

Increases a number inside a string by one . Calls the Microsoft Dynamics 365 Business Central internal “INCSTR” function. Please see Microsoft Dynamics 365 Business Central development guide for more details.

String

The input string.

CREATEGUID

Create a new GUID and returns the value.

COMMUNICATION

GETLASTNUMBER

Requires setup in the communication channel.

There is a new function GETLASTNUMBER2 that just returns the number and you can use the formatting of the converter to change the format.

Returns the last used communication number padded with 0 to 5 characters.

GETNUMBER

Requires setup in the communication channel.

There is a new function GETNUMBER2 that just returns the number and you can use the formatting of the converter to change the format.

Returns the next number from the communication channel padded with 0 to 5 characters.

GETLASTNUMBER2

Requires setup in the communication channel.

Returns the last used communication number .

GETNUMBER2

Requires setup in the communication channel.

Returns the next number form the communication channel.

RESET_PRESETS

This function only works for outgoing files and before the export mapping is started. In the export mapping you cannot change the value anymore. Resets all pre selected values for the communication, like the EDI Communication Channel and EDI Communication Partner. You can reset values from the business transaction concept and values that are set by previous or in the current mapping.

SET_COMMUNICATION_CHANNEL

This function only works for outgoing files and before the export mapping is started. In the export mapping you cannot change the value anymore. Sets the EDI Communication Channel that should be used for outgoing data.

SET_RECEIVER_PARTNER
alias SET_RECEIVER_PARTY

This function only works for outgoing files and before the export mapping is started. In the export mapping you cannot change the value anymore. Sets the EDI Communication Partner that should be used for the receiver on the outgoing data.

SET_RECEIVER_IDENTIFICATION

This function only works for outgoing files and before the export mapping is started. In the export mapping you cannot change the value anymore. Sets the receiver identification for the outgoing transmission. For outgoing SMTP communication channels the receiver ID is used as recipient e-mail address.

SET_SENDER_PARTNER
alias SET_SENDER_PARTY

This function only works for outgoing files and before the export mapping is started. In the export mapping you cannot change the value anymore. Sets the EDI Communication Partner that should be used for the sender on the outgoing data.

SET_SENDER_IDENTIFICATION

This function only works for outgoing files and before the export mapping is started. In the export mapping you cannot change the value anymore. Sets the sender identification for the outgoing transmission. For outgoing SMTP communication channels the sender ID is used as sender e-mail address.

GET_RECEIVER_IDENTIFICATION

This function only works for incoming data. Gets the receiver identification from the incoming transmission. In case of an POP3 channel this is the receiver’s e-mail address.

GET_SENDER_IDENTIFICATION

This function only works for incoming data. Gets the receiver identification from the incoming transmission. In case of an POP3 channel this is the sender’s e-mail address.

DIALOG

CONFIRM

Opens a confirmation dialog. This can be useful for testing, but is usually a bad idea in productive mappings, as they can’t be executed in the background/job.

Opens a confirmation box and returns the value chosen by the user: True for yes; or False for no.

String

The text shown to the user.

COMPANYINFORMATION

The object COMPANYINFORMATION gives you easy access to the table Company Information, without the need to add a table loop to the mapping.

Name

Gets the column “Name” from the table Company Information.

Name 2

Gets the column “Name 2” from the table Company Information.

Home Page

Gets the column “Home Page” from the table Company Information.

Address

Gets the column “Address” from the table Company Information.

Address 2

Gets the column “Address 2” from the table Company Information.

City

Gets the column “City” from the table Company Information.

Post Code

Gets the column “Post Code” from the table Company Information.

Country/Region Code

Gets the column “Country/Region Code” from the table Company Information.

Phone No.

Gets the column “Phone No.” from the table Company Information.

Phone No. 2

Gets the column “Phone No.” from the table Company Information.

Fax No.

Gets the column “Fax No.” from the table Company Information.

E-Mail

Gets the column “E-Mail” from the table Company Information.

Telex No.

Gets the column “Telex No.” from the table Company Information.

GLN

This field is special.

If there is a value in the column Global Identification Number in the table EDI Setup that value is used. Otherwise the module will try to get the content of field number 90 from the table Company Information. If that fails an empty string is returned.

VAT Registration No.

Gets the column “VAT Registration No.” from the table Company Information.

Registration No.

Gets the column “Registration No.” from the table Company Information.

Giro No.

Gets the column “Giro No.” from the table Company Information.

Bank Name

Gets the column “Bank Name” from the table Company Information.

Bank Branch No.

Gets the column “Bank Branch No.” from the table Company Information.

Bank Account No.

Gets the column “Bank Account No.” from the table Company Information.

Ship-to Name

Gets the column “Ship-to Name” from the table Company Information.

Ship-to Name 2

Gets the column “Ship-to Name 2” from the table Company Information.

Ship-to Address

Gets the column “Ship-to Address” from the table Company Information.

Ship-to Address 2

Gets the column “Ship-to Address 2” from the table Company Information.

Ship-to City

Gets the column “Ship-to City” from the table Company Information.

Ship-to Contact

Gets the column “Ship-to Contact” from the table Company Information.

Ship-to Post Code

Gets the column “Ship-to Post Code” from the table Company Information.

Ship-to County

Gets the column “Ship-to County” from the table Company Information.

GetInvoiceLines

Return a temp table with the posted invoice lines associated with this line. To use this function, you have to add a table loop in the mapping with the table Sales Invoice Line in temporary read mode. You can then use this function as the InitFunction of that loop. In the mapping you can access the data from the temp table, like from any other table instance.

If the Credit Memo Line is applied to an entry in the table Item Ledger Entry the function searches in the table Value Entry for entries that are of type sales invoice and return the data from the table Sales Invoice Line.

Parameters:

Document No.

The posted sales invoice header number.

Line No.

The posted sales invoice line number.

GetShipmentLines

Return a temp table with the shipment lines associated with this line. To use this function, you have to add a table loop in the mapping with the table Sales Shipment Line in temporary read mode. You can then use this function as the InitFunction of that loop. In the mapping you can access the data from the temp table, like from any other table instance.

If the Credit Memo Line is applied to an entry in the table Item Ledger Entry the function searches in the table Value Entry for entries that are of type sales invoice and return the data from the table Sales Shipment Line that is related to the found sales invoices.

Parameters:

Document No.

The posted sales invoice header number.

Line No.

The posted sales invoice line number.

GetReturnReceiptLines

Return a temp table with the shipment lines associated with this line. To use this function, you have to add a table loop in the mapping with the table Return Receipt Line in temporary read mode. You can then use this function as the InitFunction of that loop. In the mapping you can access the data from the temp table, like from any other table instance.

Technically we are using the table Value Entry filtered to the type Sales Return Receipt and return the data from table Return Receipt Line.

Parameters:

Document No.

The posted sales invoice header number.

Line No.

The posted sales invoice line number.