Getting Data from two companies in a report

renjitarenjita Member Posts: 40
Hi,

I want to get data from two companies for report Generation.So is their any way we can do it ?

Please suggest ?

Regards

Renjita

Comments

  • SpawnSpawn Member Posts: 10
    Hi,

    Try CHANGECOMPANY function. this function is used to redirect references to table data from one company to another.

    Example
    This example shows how to use the CHANGECOMPANY function.

    "G/L Account".CHANGECOMPANY('New Company');
    "G/L Account".GET('1000');
    "G/L Account".CALCFIELDS(Balance);// Calculates the balance
    // for account no. 1000 in
    // 'New Company'
    "G/L Entry".CHANGECOMPANY('New Company');
    "G/L Entry".SETCURRENTKEY("No.",LedgerEntry.Date);
    "G/L Entry".SETRANGE("No.",'1000');
    "G/L Entry".SETRANGE(Date,010196D,013196D);
    "G/L Entry".CALCSUMS(NetAmount); // Sums NetAmount from
    // all G/L entries on
    // account no. 1000 within
    // the specified range,
    // for 'New Company'
    "G/L Entry".RESET;
    "G/L Entry".FIND('+'); // Finds the largest "No."
    // in the G/L Entry table in
    // 'New Company'
    "G/L Entry".DELETE; // Deletes this entry in
    // 'New Company'

    This example shows that once the CHANGECOMPANY function has been called, all future references to the G/L Account and G/L Entry tables will refer to the table data in New Company.
  • renjitarenjita Member Posts: 40
    hi,

    Do we have to use Table directly or can we use record variable of the table instead ?

    like using record Variable RecG/LAccount of G/L Entry Table

    RecG/LAccount.CHANGECOMPANY('New Company');
    RecG/LAccount.GET('1000');
    RecG/LAccount.CALCFIELDS(Balance);// Calculates the balance

    Regards
    Renjita
  • SpawnSpawn Member Posts: 10
    Sure you can, you can use record variable :)
Sign In or Register to comment.