Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum
Unanswered

Change Join betweeen Form DataSources

Posted on by 70

Hi Every One ,

I have a requirement to change a join between two data Sources on Radio button  in D365 Custom Form So for that i  created my query in DataSource init method and trying to change their join on Execute Query method but that doesn't works . My query is getting build according to my requirement but join is not getting applied in execute query.

any one can help out on that to achieve that ?

 public void init()
        {
            super();
            Query query =MyTable1_ds.query();
            QueryBuildDataSource qbds;
            qbds =query.dataSourceTable(tableNum(MyTable1)).addDataSource(tableNum(MyTable2));
            qbds.clearLinks();
		    qbds.addLink(fieldNum(MyTable1, DistributionID), fieldNum(MyTable2, DistributionID));
           	qbds.joinMode(JoinMode::ExistsJoin);
			qbds.relations(false);
            
            
        }
        
        
          public void executeQuery()
        {
          
            Query query= MyTable1_ds.query();
            switch(PaymentDistributions.selection())
            {
                case  PaymentDistributions::DistributedPayments :
                    query.DataSourceTable(tableNum(MyTable1).joinMode(JoinMode::ExistsJoin);
   		            break;

                case  PaymentDistributions::NonDistributedPayments :
                    query.DataSourceTable(tableNum(MyTable1).joinMode(JoinMode::NoExistsJoin);
                    break;

                case  PaymentDistributions::AllProcessedAllocation :
                    query.DataSourceTable(tableNum(MyTable1).joinMode(JoinMode::OuterJoin);
                    break;

            }
		
            super();
        }

Under review

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

Helpful resources

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,558 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,647 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans