Searching across multiple entities

ramjet
ramjet Member Posts: 3
The organisation I work for has multiple companies setup in Navision. Clients are customers of each company and have the same customer number.

Each company generates its own unique invoices but sometime payments are credited to the wrong company. To find such a payment, we need to view the client's account in each company which can be time consuming.

Is it possible to generate a report that collects a client's transactions from all the companies?

Comments

  • kriki
    kriki Member, Moderator Posts: 9,132
    Yes, you can use the CHANGECOMPANY-function to change the company in which the record works.
    If you combine it with table Company, you can get info from all companies.

    An example:
    recCompany.RESET;
    recCompany.SETCURRENTKEY(Name);
    IF recCompany.FINDSET THEN
      REPEAT
         IF recPostedSalesInvoice.GET('some Invoice No.) THEN
           MESSAGE('Invoice exists in Company %1',recCompany.Name);
      UNTIL recCompany.NEXT = 0;
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • DenSter
    DenSter Member Posts: 8,307
    You forgot something Kriki:
    recCompany.RESET;
    recCompany.SETCURRENTKEY(Name);
    IF recCompany.FINDSET THEN
      REPEAT
         recPostedSalesInvoice.CHANGECOMPANY(recCompany.Name); // gotta set the company first
         IF recPostedSalesInvoice.GET('some Invoice No.) THEN
           MESSAGE('Invoice exists in Company %1',recCompany.Name);
      UNTIL recCompany.NEXT = 0;
    
  • kriki
    kriki Member, Moderator Posts: 9,132
    :oops:
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • DenSter
    DenSter Member Posts: 8,307
    tsk tsk tsk.... rookie mistake, we all made them :mrgreen:
  • ramjet
    ramjet Member Posts: 3
    Thanks for the replies and sorry for the late reply.

    I should have added I am quite new to Navision. How do I implement the code? Is it something we users can do or does it need to be set-up by our Navision consultant?

    Thanks again.
  • David_Singleton
    David_Singleton Member Posts: 5,479
    Everyone has there own way of doing things. I have seen this request quite few times, and to resolve it I developed a "Multi Company" Navigate function. Its an extremely simple task, just needs a new ledger table (shared across all companies) which you add to Navigate, and then just modify the look up forms with a change company, so that Navigate opens in the correct company.

    This way its totally invisible to the user, you just hit navigate it searches all companies for any document. Just make sure your partner is careful with locking, since the insert locks all companies at once.

    BTW in answer to your other question, how ever you do this, you really do want to involve your partner.
    David Singleton