Check in C/AL if DataPerCompany is true/false

MartinFKMartinFK Member Posts: 43
Hi,

does anybody know how to check the value of the DataPerCompany proberty of a table in C/AL?

I am adressing the table via RecRef.

Thanks,
Martin

Comments

  • matteo_montanarimatteo_montanari Member Posts: 189
    MartinFK wrote:
    Hi,

    does anybody know how to check the value of the DataPerCompany proberty of a table in C/AL?

    I am adressing the table via RecRef.

    Thanks,
    Martin
    OBJECT Codeunit 50000 test
    {
      OBJECT-PROPERTIES
      {
        Date=28/09/09;
        Time=18.28.05;
        Modified=Yes;
        Version List=;
      }
      PROPERTIES
      {
        OnRun=BEGIN
                MESSAGE(FORMAT(IsDataPerCompany(27)));
                MESSAGE(FORMAT(IsDataPerCompany(2000000004)));
              END;
    
      }
      CODE
      {
    
        PROCEDURE IsDataPerCompany@1000000000(TableID@1000000000 : Integer) : Boolean;
        VAR
          Object@1000000001 : Record 2000000001;
        BEGIN
          Object.SETRANGE(Type, Object.Type::TableData);
          Object.SETRANGE("Company Name", '');
          Object.SETRANGE(ID, TableID);
          EXIT(NOT Object.ISEMPTY);
        END;
    
        BEGIN
        END.
      }
    }
    

    Bye

    Matteo
    Reno Sistemi Navision Developer
  • matttraxmatttrax Member Posts: 2,309
    Yes, if the table is DataPerCompany there should be one object per company in the Object table, otherwise the company name will be blank, meaning that it refers to all tables.
  • MartinFKMartinFK Member Posts: 43
    Thanks .... that helped.

    Best Regards,
    Martin
  • BeliasBelias Member Posts: 2,998
    also "Table Data" table works (instad of object table)
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
Sign In or Register to comment.