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.

ISNOTEMPTY

Returns True, if there is one or more records inside the filter.
In other words, the count is not equal zero.

RECORDID

Returns the RecordID of the current instance. Should be called from a child of the table loop.

BUSINESS_TRANSACTION

SetReferenceNo

Set the reference number in the table EDI Business Transaction. There is only one parameter:

Reference No.

The reference number to be used. A text with max. 80 characters.

SENDER_PARTNER

Code

Retrieves the column Code from the sender partner, which is defined by a previous mapping or the business transaction.

Remote Receiver/Sender ID

Retrieves the column Remote Receiver/Sender ID from the sender partner, which is defined by a previous mapping or the business transaction.

Our Receiver/Sender ID

Retrieves the column Our Receiver/Sender ID from the sender partner, which is defined by a previous mapping or the business transaction.

Name

Retrieves the column Name from the sender partner, which is defined by a previous mapping or the business transaction.

Name 2

Retrieves the column Name 2 from the sender partner, which is defined by a previous mapping or the business transaction.

Address

Retrieves the column Address from the sender partner, which is defined by a previous mapping or the business transaction.

Address 2

Retrieves the column Address 2 from the sender partner, which is defined by a previous mapping or the business transaction.

City

Retrieves the column City from the sender partner, which is defined by a previous mapping or the business transaction.

Contact

Retrieves the column Contact from the sender partner, which is defined by a previous mapping or the business transaction.

Post Code

Retrieves the column Post Code from the sender partner, which is defined by a previous mapping or the business transaction.

County

Retrieves the column County from the sender partner, which is defined by a previous mapping or the business transaction.

Country/Region Code

Retrieves the column Country/Region Code from the sender partner, which is defined by a previous mapping or the business transaction.

Phone No.

Retrieves the column Phone No. from the sender partner, which is defined by a previous mapping or the business transaction.

Telex No.

Retrieves the column Telex No. from the sender partner, which is defined by a previous mapping or the business transaction.

Fax No.

Retrieves the column Fax No. from the sender partner, which is defined by a previous mapping or the business transaction.

VAT Registration No.

Retrieves the column VAT Registration No. from the sender partner, which is defined by a previous mapping or the business transaction.

Our Account No.

Retrieves the column Our Account No. from the sender partner, which is defined by a previous mapping or the business transaction.

GLN

Retrieves the column GLN from the sender partner, which is defined by a previous mapping or the business transaction.

Test Flag

Retrieves the column Test Flag from the sender partner, which is defined by a previous mapping or the business transaction.

RECEIVER_PARTNER

Code

Retrieves the column Code from the receiver partner, which is defined by a previous mapping or the business transaction.

Remote Receiver/receiver ID

Retrieves the column Remote Receiver/receiver ID from the receiver partner, which is defined by a previous mapping or the business transaction.

Our Receiver/receiver ID

Retrieves the column Our Receiver/receiver ID from the receiver partner, which is defined by a previous mapping or the business transaction.

Name

Retrieves the column Name from the receiver partner, which is defined by a previous mapping or the business transaction.

Name 2

Retrieves the column Name 2 from the receiver partner, which is defined by a previous mapping or the business transaction.

Address

Retrieves the column Address from the receiver partner, which is defined by a previous mapping or the business transaction.

Address 2

Retrieves the column Address 2 from the receiver partner, which is defined by a previous mapping or the business transaction.

City

Retrieves the column City from the receiver partner, which is defined by a previous mapping or the business transaction.

Contact

Retrieves the column Contact from the receiver partner, which is defined by a previous mapping or the business transaction.

Post Code

Retrieves the column Post Code from the receiver partner, which is defined by a previous mapping or the business transaction.

County

Retrieves the column County from the receiver partner, which is defined by a previous mapping or the business transaction.

Country/Region Code

Retrieves the column Country/Region Code from the receiver partner, which is defined by a previous mapping or the business transaction.

Phone No.

Retrieves the column Phone No. from the receiver partner, which is defined by a previous mapping or the business transaction.

Telex No.

Retrieves the column Telex No. from the receiver partner, which is defined by a previous mapping or the business transaction.

Fax No.

Retrieves the column Fax No. from the receiver partner, which is defined by a previous mapping or the business transaction.

VAT Registration No.

Retrieves the column VAT Registration No. from the receiver partner, which is defined by a previous mapping or the business transaction.

Our Account No.

Retrieves the column Our Account No. from the receiver partner, which is defined by a previous mapping or the business transaction.

GLN

Retrieves the column GLN from the receiver partner, which is defined by a previous mapping or the business transaction.

Test Flag

Retrieves the column Test Flag from the receiver partner, which is defined by a previous mapping or the business transaction.

TRANSMISSION

TESTFLAG

Whether the current transmission is flagged as test.

COMPARE

The functions of the compare object are usually used in combination with a conditional line. Normally there are two parameters available, Value 1 and Value 2. The first value is compared with the chosen operator to the second one. The first value defines which data type is used for comparison, in case both values have not the same data type.

IsEqual

Return True if both values are equal; False otherwise. (Value 1 = Value 2)

IsNotEqual

Return False if both values are equal; True otherwise. (Value 1 <> Value 2)

IsGreater

Return True, if Value 1 is greater than Value 2; False otherwise. (Value 1 > Value 2)

IsGreaterOrEqual

Return True, if Value 1 is greater or equal than Value 2; False otherwise. (Value 1 >= Value 2)

IsLess

Return True, if Value 1 is less than Value 2; False otherwise. (Value 1 < Value 2)

IsLessOrEqual

Return True, if Value 1 is less or equal than Value 2; False otherwise. (Value 1 <= Value 2)

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 NAV 2015.

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 NAV 2015 development guide for more details.

DateExpression

The calculation expression.

Date

The date on which the calculation is based on.

FORMAT

Calls the Microsoft Dynamics NAV 2015 internal “FORMAT” function. Please see Microsoft Dynamics NAV 2015 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 NAV 2015 internal “COPYSTR” function. Please see Microsoft Dynamics NAV 2015 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.

ROUND_TO

This round function is meant to be an easy way to round any number to the given decimal digits. This is easier to setup and understand than the also available ROUND function that Microsoft Dynamics NAV 2015 provides.

Number

The input number.

Decimal Places

The number of decimal digits. E.g. 2 to round the number 1.234 to 1.23.

ROUND

This round function provides the Microsoft Dynamics NAV 2015 internal function to the mapping. We also offer the function ROUND_TO as an easier alternative. See the Microsoft Dynamics NAV 2015 help for more information on the parameters of this function.

Number

The input number.

Precision

The precision represented as an decimal, like 0.01 for 2 decimal places.

Direction

The rounding direction. This defaults to =, meaning nearest, but you can use < and > to always round down or up.

STRPOS

Searches for the first occurrence of a substring within a string. Returns a 1 based index of the first occurence. Return 0 if the string is not found.

String

The string to be searched.

SubString

The substring for which you want to search.

DELSTR

Deletes a substring inside a string and returns the new string.

String

The input string.

Position

The position of the substring you want to delete. This is a 1 based index.

Length

The length of the substring you want to delete.

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 NAV 2015 internal “DELCHR” function. Please see Microsoft Dynamics NAV 2015 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 characters to the output characters. Calls the Microsoft Dynamics NAV 2015 internal “CONVERTSTR” function. Please see Microsoft Dynamics NAV 2015 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 NAV 2015 internal “PADSTR” function. Please see Microsoft Dynamics NAV 2015 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 NAV 2015 internal “INCSTR” function. Please see Microsoft Dynamics NAV 2015 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.

COUNTER

The counter object allows you to count values inside of one mapping. You can have multiple counters, each identified by a name.

The following functions are available:

GET_NEXT_NUMBER

Returns the next number for a specified counter. The counter will start with the value one.

Name

The name of the counter.

GET_LAST_NUMBER

Returns the last number for a specified counter. If the counter was not initialized the function will return zero.

Name

The name of the counter.

CLEAR

Resets the counter to zero.

Name

The name of the counter.

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.

SALES

These functions are new in Anveo EDI Connect 4.00. They assume that you’re using a standard NAV without customizations. If you’ve customized standard object, please make sure that they behave like expected.

POST

Starts the posting routine for a sales document. If there are any errors during the posting routine, the mapping will break immediately. Because the posting routines can contain COMMIT code, all data before the posting routine may already be written.

We highly recommend to execute this function in a separate mapping and do not write to any table from that mapping.

The parameters are:

Document Type

The document type of the sales document. (Sales Header)

No.

The number of the sales document.

Ship

A boolean flag whether to post the shipment.

Invoice

A boolean flag whether to post the invoice.

PURCHASE

These functions are new in Anveo EDI Connect 4.00. They assume that you’re using a standard NAV without customizations. If you’ve customized standard object, please make sure that they behave like expected.

POST

Starts the posting routine for a purchase document. If there are any errors during the posting routine, the mapping will break immediately. Because the posting routines can contain COMMIT code, all data before the posting routine may already be written.

We highly recommend to execute this function in a separate mapping and do not write to any table from that mapping.

The parameters are:

Document Type

The document type of the purchase document. (Purchase Header)

No.

The number of the purchase document.

Receive

A boolean flag whether to post the receipt.

Invoice

A boolean flag whether to post the invoice.

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.

SALES_INVOICE

These functions are new in Anveo EDI Connect 4.00. They assume that you’re using a standard NAV without customizations. If you’ve customized standard object, please make sure that they behave like expected.

These functions are related to posted sales invoice headers. Or, in technical terms, these function are related to the Microsoft Dynamics NAV 2015 table with the name Sales Invoice Header.

GetShipmentNoIfUnique

Returns the sales shipment number, if it is unique; otherwise an empty string is returned. Or in other words, if there were no partial shipments and there is only one shipment associated with this invoice.

Invoice No.

The posted sales invoice number for which the shipments are to be searched.

GetShipmentNoList

Returns a list of all shipment number, as long as they require less than 1024 characters. If the list is longer an error occurs.

Invoice No.

The posted sales invoice number for which the shipments are to be searched.

Separator

The text that should be used to separate the documents. Can, for example, be a constant value of type Text (Special) with the value ,<SP>.

SALES_INVOICE_LINE

These functions are new in Anveo EDI Connect 4.00. They assume that you’re using a standard NAV without customizations. If you’ve customized standard object, please make sure that they behave like expected.

These functions are related to posted sales invoice lines. Or, in technical terms, these function are related to the Microsoft Dynamics NAV 2015 table with the name Sales Invoice Line.

GetItemChargeValueEntries

Return a temp table with the value entries for charges and allowances associated with this line. To use this function, you have to add a table loop in the mapping with the table Value Entry 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 to find the entries in the table Item Ledger Entry and return the associated data from table Value Entry filtered to the current document number, which is of the type Adjustment.

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.

Technically we are using the table Value Entry to find the entries in the table Item Ledger Entry and return data from the table Sales Shipment Line.

Parameters:

Document No.

The posted sales invoice header number.

Line No.

The posted sales invoice line number.

SALES_CREDIT_MEMO

These functions are new in Anveo EDI Connect 4.00. They assume that you’re using a standard NAV without customizations. If you’ve customized standard object, please make sure that they behave like expected.

These functions are related to posted sales credit memo headers. Or, in technical terms, these function are related to the Microsoft Dynamics NAV 2015 table with the name Sales Cr.Memo Header.

GetInvoiceNoIfUnique

Returns the sales invoice number, if it is unique; otherwise an empty string is returned.

Credit Memo No.

The posted credit memo for which the associated invoices are to be searched.

GetInvoiceNoList

Returns a list of all invoice numbers, as long as they require less than 1024 characters. If the list is longer an error occurs.

Credit Memo No.

The posted sales invoice number for which the shipments are to be searched.

Separator

The text that should be used to separate the documents. Can, for example, be a constant value of type Text (Special) with the value ,<SP>.

SALES_CREDIT_MEMO_LINE

These functions are new in Anveo EDI Connect 4.00. They assume that you’re using a standard NAV without customizations. If you’ve customized standard object, please make sure that they behave like expected.

These functions are related to posted sales credit memo headers. Or, in technical terms, these function are related to the Microsoft Dynamics NAV 2015 table with the name Sales Cr.Memo Line.

GetItemChargeValueEntries

Return a temp table with the value entries for charges and allowances associated with this line. To use this function, you have to add a table loop in the mapping with the table Value Entry 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 to find the entries in the table Item Ledger Entry and return the associated data from table Value Entry filtered to the current document number, which is of the type Adjustment.

Parameters:

Document No.

The posted sales credit header number.

Line No.

The posted sales credit line number.

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.