Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 175888

How to combine two different Count record as one statement or output

$
0
0

Hello,

I have below code which get  number of records with related owner name. Its working without any issue. But I need owner name not to be repeat and count related number of records in leads and opportunities.

My expected output:

Owner Name        No.of Leads    No.of Opportunities

ABC                           2                      5

BAC                           4                     6

My code.

static void countalluser(Args _args)
{
    smmLeadTable leadTable;
    smmOpportunityTable ssmmOpportunityTable;
        while select  count(OpportunityId) from ssmmOpportunityTable group by ssmmOpportunityTable.OwnerWorker
    {
        Info(strFmt("Number of Records opportu %1 with oppor Owner %2",
              ssmmOpportunityTable.OpportunityId,
              ssmmOpportunityTable.ownerName()
                    )
                );  
    }
        while select  count(LeadId) from leadTable group by leadTable.OwnerWorker
    {
         Info(strFmt("Number of Records Lead %1 with lead owner %2",
              leadTable.LeadId,
              leadTable.ownerName()
                    )
                );    
    }
    }

Viewing all articles
Browse latest Browse all 175888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>