jsshivalikjsshivalik Posts: 65Member

In a Database we have 2 companies. when i run the report i get Data from 1 Company . I want to get some Data in this particular report from Other Companies Item Ledger Entry table.

We can say i want to create a single report combining data from both Companies. I am using Navision 2013.



  • Slawek_GuzekSlawek_Guzek Posts: 1,677Member
    It is possible but requires a lot of coding.

    Look at CHANGECOMPANY function on a rec variable - it enables yout to switch company on a record. But its scope is limited - it only changes company in the record var on which it is called. It means that you would need to change company on every single record var used on your report, and each time after a record var is cleared (CLEAR(RecVar)) or reset (RecVar.RESET);

    You report structure needs to look like this
    DataItem Company
      DataItem [Your header table]
          DataItem  [Your details table]
    And the in Company - OnAfterGetRecord:
    [Your header table].CHANGECOMPANY(Company.Name);
      [Your details table].CHANGECOMPANY(Company.Name);
      [Your global table var 1].CHANGECOMPANY(Company.Name);
      [Your global table var 2].CHANGECOMPANY(Company.Name);
      //...and so on

    On the top of this in every single place in he report where you use a local rec var, or have a call to RESET/CLEAR on a local or global rec var you also need to add "your var".CHANGECOMPANY(Company.Name); statement
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • krikikriki Posts: 8,720Member, Moderator
    [Topic moved from 'NAV/Navision Classic Client' forum to 'NAV Three Tier' forum]

    Regards,Alain Krikilion
    Use the SEARCH,Luke! || No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
    NAV TechDays 2019: 21 & 22 November 2019, Antwerp (Belgium)
Sign In or Register to comment.