Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)
Under review by Community Managers

Under review

Thank you for your post! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Issue with generalJounralEntry table crosscompany data not executing

Posted on by 1,869
Hello,
 
In the below simple job, I'm trying to get data from a specific company based on the dataAreaId field. Despite the fact that I did not mention it in the below code, the below code always executes the data of dat company. If you could advise how I can change the following code to get data from a specific company, I would appreciate it.
 
 class TestJournalCode
{
    public static void main(Args _args)
    {
        GeneralJournalAccountEntry genralJournalAccountEntry, genralJournalAccountEntryprev;
        GeneralJournalEntry  generalJounralEntry;
        MainAccount mainAccount;
        Date fromDate, toDate;
        fromdate =str2Date(/1/21/2015/,213);
        toDate = str2Date(/1/21/2015/,213);
        DataAreaId dataAreaId;
       // List journallist = new List(Types::Class);
        ;
       select crosscompany *from generalJounralEntry
                    where generalJounralEntry.DataAreaId == /USMF/
                    &&  generalJounralEntry.AccountingDate >= fromdate
            && generalJounralEntry.AccountingDate <= toDate;
      
          Info(generalJounralEntry.DataAreaId);
          Info(generalJounralEntry.JournalNumber);
         
        
    }
}
 
The output of the code always executing from dat comapny.
 

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans