name - changecompany

T222T222 Member Posts: 63
edited 2015-10-02 in NAV Three Tier
Hi,

I've made a small program which reads figures from customers record multicompanies using the changecompany function.
However , although the customer name is different for each company , it shows me for all the companies the same name.
The figures are correct.
Can you please help me on this?

Comments

  • neilgfneilgf Member Posts: 148
    Hi

    How are you collecting this data your program? If you are using CHANGECOMPANY C/Side code you already know the company code so is it a company name issue?

    Neil
  • T222T222 Member Posts: 63
    Yes its with Changecompany.
    I collect figures from customers. The customer name is different on each company but it gives me the same customer names.
  • T222T222 Member Posts: 63
    forgot to mention is a report
  • neilgfneilgf Member Posts: 148
    Hi

    Can you send your code?

    Neil
  • T222T222 Member Posts: 63
    this is on the Section of report - Customer body - Onpresection


    Customer.CHANGECOMPANY('Company Name Test1');

    Customer.CALCFIELDS("Net Change (LCY)");
    Customer.CALCFIELDS(Balance);
    Customer.CALCFIELDS("Net Change");
    customer.CALCFIELDS("Balance (LCY)");
    name1:=Customer.Name;
  • MarijnMarijn Member Posts: 69
    Changecompany only works in de simplest of cases. It will flip a single table to another company. But if that table has code in triggers which reads or modifies data in other tables, then these other tables will still be the ones from the UNchanghed company. So that's completely wrong and you might destroy your data. Avoid using changecompany. I never use it. It's useless. Use webservices to execute businsess logic in other companies. This way you can even post a sales document in another company.
Sign In or Register to comment.