Search code examples
navisiondynamics-navmicrosoft-dynamics-nav

How to check recref.field(Integer) is empty or exists in Navision Development ( C/ALL )?


RecRef is datatype of RecRef, and by this i access to table and can select the field of the table;

RecRef.OPEN(IDTABLE);
RecRef.field(2); // RETURN THE FIELD DATA OF THE IDTABLE.

but if this is empty navision send error so;

How to check if RecRef.field(Integer) is empty or exists in Navision Development (C/ALL)?

Thanks in advance,


Solution

  • You may use virtual table Field to check which field numbers exist in a table, as well as their data types and other properties.

    https://msdn.microsoft.com/en-us/library/dd301354(v=nav.90).aspx

    You may also reference fields using RecRef.FIELDINDEX(i), where i is between 1 and RecRef.FIELDCOUNT. By this you do not need to guess field numbers if you do not know them.

    I would also advise to look at Codeunits 423 Change Log Management and 8617 Config. Validate Management for advanced examples and scenarios of working with RecordRefs and FieldRefs.