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
Returns the count of record inside the filter.
Allows you to delete the current record. You have to enable this functionality in the EDI Setup. By default this function is not available.
Returns True, if there is no record inside the filter. In other words, the count is equal to zero.
Returns True, if there is one or more records inside the filter.
In other words, the count is not equal zero.
Returns the RecordID of the current instance. Should be called from a child of the table loop.
BUSINESS_TRANSACTION
Set the reference number in the table EDI Business Transaction. There is only one parameter:
The reference number to be used. A text with max. 80 characters.
SENDER_PARTNER
Retrieves the column Code from the sender partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Remote Receiver/Sender ID from the sender partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Our Receiver/Sender ID from the sender partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Name from the sender partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Name 2 from the sender partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Address from the sender partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Address 2 from the sender partner, which is defined by a previous mapping or the business transaction.
Retrieves the column City from the sender partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Contact from the sender partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Post Code from the sender partner, which is defined by a previous mapping or the business transaction.
Retrieves the column County from the sender partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Country/Region Code from the sender partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Phone No. from the sender partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Telex No. from the sender partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Fax No. from the sender partner, which is defined by a previous mapping or the business transaction.
Retrieves the column VAT Registration No. from the sender partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Our Account No. from the sender partner, which is defined by a previous mapping or the business transaction.
Retrieves the column GLN from the sender partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Test Flag from the sender partner, which is defined by a previous mapping or the business transaction.
RECEIVER_PARTNER
Retrieves the column Code from the receiver partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Remote Receiver/receiver ID from the receiver partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Our Receiver/receiver ID from the receiver partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Name from the receiver partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Name 2 from the receiver partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Address from the receiver partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Address 2 from the receiver partner, which is defined by a previous mapping or the business transaction.
Retrieves the column City from the receiver partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Contact from the receiver partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Post Code from the receiver partner, which is defined by a previous mapping or the business transaction.
Retrieves the column County from the receiver partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Country/Region Code from the receiver partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Phone No. from the receiver partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Telex No. from the receiver partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Fax No. from the receiver partner, which is defined by a previous mapping or the business transaction.
Retrieves the column VAT Registration No. from the receiver partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Our Account No. from the receiver partner, which is defined by a previous mapping or the business transaction.
Retrieves the column GLN from the receiver partner, which is defined by a previous mapping or the business transaction.
Retrieves the column Test Flag from the receiver partner, which is defined by a previous mapping or the business transaction.
TRANSMISSION
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.
Return True if both values are equal; False otherwise. (Value 1 = Value 2)
Return False if both values are equal; True otherwise. (Value 1 <> Value 2)
Return True, if Value 1 is greater than Value 2; False otherwise. (Value 1 > Value 2)
Return True, if Value 1 is greater or equal than Value 2; False otherwise. (Value 1 >= Value 2)
Return True, if Value 1 is less than Value 2; False otherwise. (Value 1 < Value 2)
Return True, if Value 1 is less or equal than Value 2; False otherwise. (Value 1 <= Value 2)
DATABASE
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
Returns the current work date of Microsoft Dynamics NAV 2017.
Returns today’s date.
Returns the current time.
Returns the current date/time.
Returns a combined date/time information from two separate values.
The date part
The time part
Returns a calculated date. Please see Microsoft Dynamics NAV 2017 development guide for more details.
The calculation expression.
The date on which the calculation is based on.
Calls the Microsoft Dynamics NAV 2017 internal “FORMAT” function. Please see Microsoft Dynamics NAV 2017 development guide for more details.
The source value.
The maximal length.
The format string or format number.
Gets a substring of the input. Calls the Microsoft Dynamics NAV 2017 internal “COPYSTR” function. Please see Microsoft Dynamics NAV 2017 development guide for more details.
The input string.
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.
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.
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 2017 provides.
The input number.
The number of decimal digits. E.g. 2 to round the number 1.234 to 1.23.
This round function provides the Microsoft Dynamics NAV 2017 internal function to the mapping. We also offer the function ROUND_TO as an easier alternative. See the Microsoft Dynamics NAV 2017 help for more information on the parameters of this function.
The input number.
The precision represented as an decimal, like 0.01 for 2 decimal places.
The rounding direction. This defaults to =, meaning nearest, but you can use < and > to always round down or up.
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.
The string to be searched.
The substring for which you want to search.
Deletes a substring inside a string and returns the new string.
The input string.
The position of the substring you want to delete. This is a 1 based index.
The length of the substring you want to delete.
Return the count of characters of the input string.
The input string whose length is returned.
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.
The input string.
The input string.
The input string.
The input string.
The input string.
Removes characters from an input. Calls the Microsoft Dynamics NAV 2017 internal “DELCHR” function. Please see Microsoft Dynamics NAV 2017 development guide for more details.
The input string.
You can specify where you want to delete data:
At the begin of the string
At the end of the string
At any position
The characters to be deleted. If this parameter is empty the module will remove spaces.
Changes the input characters to the output characters. Calls the Microsoft Dynamics NAV 2017 internal “CONVERTSTR” function. Please see Microsoft Dynamics NAV 2017 development guide for more details.
The input string.
The input characters as a string, wihout any delimiters.
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.
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 2017 internal “PADSTR” function. Please see Microsoft Dynamics NAV 2017 development guide for more details.
The input string.
The target string length.
The charcter used to pad the string.
Increases a number inside a string by one . Calls the Microsoft Dynamics NAV 2017 internal “INCSTR” function. Please see Microsoft Dynamics NAV 2017 development guide for more details.
The input string.
Create a new GUID and returns the value.
COMMUNICATION
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.
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.
Requires setup in the communication channel.
Returns the last used communication number .
Requires setup in the communication channel.
Returns the next number form the 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. 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.
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.
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.
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.
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.
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.
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.
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:
Returns the next number for a specified counter. The counter will start with the value one.
The name of the counter.
Returns the last number for a specified counter. If the counter was not initialized the function will return zero.
The name of the counter.
Resets the counter to zero.
The name of the counter.
DIALOG
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.
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.
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:
The document type of the sales document. (Sales Header)
The number of the sales document.
A boolean flag whether to post the shipment.
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.
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:
The document type of the purchase document. (Purchase Header)
The number of the purchase document.
A boolean flag whether to post the receipt.
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.
Gets the column “Name” from the table Company Information.
Gets the column “Name 2” from the table Company Information.
Gets the column “Home Page” from the table Company Information.
Gets the column “Address” from the table Company Information.
Gets the column “Address 2” from the table Company Information.
Gets the column “City” from the table Company Information.
Gets the column “Post Code” from the table Company Information.
Gets the column “Country/Region Code” from the table Company Information.
Gets the column “Phone No.” from the table Company Information.
Gets the column “Phone No.” from the table Company Information.
Gets the column “Fax No.” from the table Company Information.
Gets the column “E-Mail” from the table Company Information.
Gets the column “Telex No.” from the table Company Information.
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.
Gets the column “VAT Registration No.” from the table Company Information.
Gets the column “Registration No.” from the table Company Information.
Gets the column “Giro No.” from the table Company Information.
Gets the column “Bank Name” from the table Company Information.
Gets the column “Bank Branch No.” from the table Company Information.
Gets the column “Bank Account No.” from the table Company Information.
Gets the column “Ship-to Name” from the table Company Information.
Gets the column “Ship-to Name 2” from the table Company Information.
Gets the column “Ship-to Address” from the table Company Information.
Gets the column “Ship-to Address 2” from the table Company Information.
Gets the column “Ship-to City” from the table Company Information.
Gets the column “Ship-to Contact” from the table Company Information.
Gets the column “Ship-to Post Code” from the table Company Information.
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 2017 table with the name Sales Invoice Header.
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.
The posted sales invoice number for which the shipments are to be searched.
Returns a list of all shipment number, as long as they require less than 1024 characters. If the list is longer an error occurs.
The posted sales invoice number for which the shipments are to be searched.
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 2017 table with the name Sales Invoice Line.
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:
The posted sales invoice header number.
The posted sales invoice line number.
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:
The posted sales invoice header number.
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 2017 table with the name Sales Cr.Memo Header.
Returns the sales invoice number, if it is unique; otherwise an empty string is returned.
The posted credit memo for which the associated invoices are to be searched.
Returns a list of all invoice numbers, as long as they require less than 1024 characters. If the list is longer an error occurs.
The posted sales invoice number for which the shipments are to be searched.
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 2017 table with the name Sales Cr.Memo Line.
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:
The posted sales credit header number.
The posted sales credit line number.
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:
The posted sales invoice header number.
The posted sales invoice line number.
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:
The posted sales invoice header number.
The posted sales invoice line number.
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:
The posted sales invoice header number.
The posted sales invoice line number.