Passing Records and RecordRefs via Variants

As developers in an ever more repeatable world we should strive to write code in ways that make it as flexible and generic as we possibly can. A trick I use is too pass things around in ever more generic ways by using Variants.

A good example can be seen below where the function ReturnRecordIDasText function takes either a Record or a RecordRef as input and then returns the RECORDID as text.

Bron : Thinking NAV – Thinking Differently
Lees meer…

In NAV 2013 R2 RecordRef.CURRENTKEYINDEX can return -1

In NAV 2013 R2, if a RecordRef does not have a active record, CURRENTKEYINDEX will return -1. IN NAV2009 and older, the value was 1 (As the number of the primary key).

If the value of CURRENTKEYINDEX is given to KEYINDEX – a index out of bounds error will occur.

This is not documented in the NAV 2013 R2 help.

Bron :
Lees meer…

“The length of the source exceeds the size of the destination buffer” error when using FORMAT function for RecordRef variable

Recently, one of our client started getting error “The length of the source exceeds the size of the destination buffer” when trying to export text file using code (not using dataport). They were exporting file daily since many years and objects also not modified since long time but suddenly they started getting this error message.

Bron : Rakesh Patel’s blog for Navision
Lees meer…