How to safely check whether or not a table object has LinkedProperty set to yes?


I have an instance of an Object virtual table which contains all the TableData objects (others are filtered), and i want to iterate through every one of them and find out whether or not they have any data in them using an instance of a TableInformation virtual table (I jusat need the ID’s from the Object instance).

I am trying to access table objects via an instance of a TableInformation because it contains info on whether or not table objects have any data in them.

I’m doing this in a report (Nav 2009 Classic) and all of this works just fine, except when i try to access table objects that have the LinkedObject property set to “yes”, the program breaks and gives an error message that the table object doesn’t exist. To be more precise, i want to avoid accessing these, but access all the other normal tables.

To access the tables i use the TableInformation.GET method, and when it tries to access them, instead of simpy returning false, as i would expect, and skips these tables, navision reports an error and terminates the execution of the report even though i have put it in an IF statement.

It looks like this:

IF TableInformation.GET(CompanyName, ObjectID) THEN BEGIN

What i would want is to somehow know, if an object being accessed has LinkedObject property set to yes in advance, and simply skip it and check all the other table objects for data.

Is such a thing possible, and if it is, what is the best way to do this?

Thank you in advance :slight_smile:

If you want to know if a certain table has data in it, why not use a RecordRef variable then?




I know this will not skip the linked tables, but it will tell you if a record it is empty or not (for the current company).

Yes I have tried that, but that solution is worse then this one because:

a) It still gives the same error

b) It cannot access tables that are not included in the license, which is an information i also need to know

Any other suggestions? Any help would be appreciated.

You can always read the “License permission” table first in order to assure that you include the licensed tables only.

In order to “safely” say if a table is linked or not, you would need to read the BLOB of the object (type table) and check at a certain position in the binary stream.

We are doing (have been doing before NAV2016) in order to determine what record a page/report/CU is running on.

First step:

  • Create a new table, save and compile
  • export BLOB to file
  • CHANGE table to Linked, save and compile
  • export BLOB to another file
  • compare the two files with a Hex Editor and note the differences
  • check the Integer value BEFORE the difference and the position.

Now, iterate through the objects and call CREATEINSTREAM on the BLOB
Read as many integers as you need to reach that position, check if integer matches the value you have been determining before
Read next integer and you should know from your comparison if linked or not.

Sounds good but is this compatible with all the navision versions?

And to automate it, should i find that “point” in binary stream everytime before running the report?

This code would work from Navision 3.xx and later.

@Thomas, did almost forget your always over the standard replies. You’ve been missed.

Thanks, Erik.

Thank you for your answers.