AL icon indicating copy to clipboard operation
AL copied to clipboard

Get Table property "TableType"

Open ccourvoisier opened this issue 8 years ago • 2 comments

hello,

to list all table of Business Central we only have AllObj table.

I try to use this table and a Record Ref to count record on all table.

procedure LoadTable();
var
  AllObject: Record AllObj; 
  RecRef: RecordRef;
  Counter: Integer;
begin
  AllObject.reset;
  AllObject.SetRange("Object Type", AllObject."Object Type"::Table);
  if AllObject.FindSet(false) then
  repeat
    RecRef.open(AllObject."Object ID");
    Counter := RecRef.Count();
    RecRef.Close();
  until AllObject.Next() = 0;
end

Some table rise an error because of its property TableType (MicrosoftGraph, CRM...etc).

Table connection for table type MicrosoftGraph must be registered using RegisterTableConnection or cmdlet New-NAVTableConnection before it can be used.

I would like to skip these tables but there isn't any function to get property "TableType" of a table.

thanks in advance for your help

ccourvoisier avatar Oct 08 '18 19:10 ccourvoisier

@titofffffff Have a look at "Table Metadata" table.

In a proof of concept I was working on last week, I was able to filter against that table as follows (I too experienced the same issue as you when it encountered tables where table type was CRM, MicrosoftGraph, etc).

TableMetadata.SetRange(TableType, TableMetadata.TableType::Normal);

SteveKrisjanovsD365 avatar Oct 09 '18 21:10 SteveKrisjanovsD365

Thank you @CanuckNav74 issue solved 👍

ccourvoisier avatar Oct 11 '18 11:10 ccourvoisier