dbCALLFIELDCODE vs. dbSELECCOMPANY

Hi,

we want to use dbCALLFIELDCODE in a function from company (A) on a table-variable which was set to an other company (B) by dbSELECTCOMPANY.

In the fieldcode other tables are used. These other tables still recieve the records from company A where the function is started. But we want the records from the company B!

Is there a solution?

Marc

  • Hi Marc,

    Unfortunately the only way to do it is to set the companyname in each table with coding.

    This can be done with a function that fills a global variable with the name of company B:

    In Table B:
    ChangeComp(CompNameLcl : Text[50])
    CompNameGbl := CompNameLcl;

    In Table A:
    TableB.ChangeComp('CompanyNameB');
    TableB.CHANGECOMPANY('CompanyNameB'); // Maybe not needed
    TableB.AFunction;

    Whenever you use a Record in Table B you can simply change the company when necessary:
    AFunction()
    IF CompNameGbl <> '' THEN
    Rec3.CHANGECOMPANY(CompNameGbl);


    Regards,

    Reijer.


Related