1

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,

Jonathan Bravetti
  • 2,228
  • 2
  • 15
  • 29
Tabutnas
  • 35
  • 6

1 Answers1

1

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.

sergeyol
  • 701
  • 3
  • 10
  • Thanks, but after search on the codeUnits i don't find how to detect if the field is empty ( In Navision Dynamics Nav this field haven't info). Because after send if the RecRef.FIELD(lCounter).Type is text, integer... etc the navision send error and say the field is empty :) – Tabutnas Jul 17 '17 at 14:35
  • 1
    You can use IF RecRef.FIELDEXIST(i) THEN ... to check if the field with the specified number exists. If the field exists but is empty, then you can perfectly use RecRef.FIELD(i) – sergeyol Jul 18 '17 at 08:17
  • Thanks Sergeyol, is what i needed.. One thing more is ¿ how you know the question ? i am new at Navision development and is hard to find this things what are so easy in other program languajes. – Tabutnas Jul 18 '17 at 14:58