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?
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.