Accessing Multiple Books' Data

RachelSoonRachelSoon Member Posts: 202
Hi,

I would like to lookup Company Book B data while my current active book is Compaby A.

I tried using "CHANGECOMPANY" but it doesn't work.
Is there any other command/ method can achieve my above request?

Hope someone out there can share if you have encountered similar situation.
Thank you!

Comments

  • jglathejglathe Member Posts: 639
    Hi,

    Changecompany is the command. It only changes the company selection for the table given as parameter, not for any variables or tables accessed through flowfields of this table. So, you can't use any C/AL using non-global tables or flowfields. This makes the access a good deal more complicated than expected.

    with best regards

    Jens
  • RachelSoonRachelSoon Member Posts: 202
    Hi,
    Since "CHANGECOMPANY" will not be able to be used as a variable to look up to the record in another company book,
    anyone has method/suggestions in order to do so?

    Thank you.
  • jglathejglathe Member Posts: 639
    Hi,

    it is possible to build this, and you need CHANGECOMPANY for it. The catch is that you don't have flowfields and validates. Showing the entries of an account in a different company is not really a problem, showing balances of a different company in the chart of accounts is more complicated.

    with best regards

    Jens
  • RachelSoonRachelSoon Member Posts: 202
    Hi Jens,
    Thank for the reply.

    I am not showing the balance in a different company. I just need to lookup the Vendor list.

    I did the following code at the text box (OnLookup) on a form, but it doesn't retrieve the vendor from Company B, it's still
    showing the Vendor from the current active company:

    Vendor.CHANGECOMPANY("COMPANYB");
    IF FORM.RUNMODAL(FORM::"Vendor List", Vendor) = ACTION::LookupOK THEN
    "OtherVendor" := Vendor."No.";

    Thank you.
  • jglathejglathe Member Posts: 639
    Hi,

    the code looks like it should work.

    with best regards

    Jens
Sign In or Register to comment.