web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Combine two N:N FetchX...
Power Apps
Unanswered

Combine two N:N FetchXML querys

(0) ShareShare
ReportReport
Posted on by 559

Hey experts,

 

I am trying to get all cursists from a particular training (N:N) and from all cursists returned I am trying to retrieve their roles (N:N). I am looking if there is a way to combine these querys:

 

 

//GET TRAINEES

StringBuilder linkFetch3 = new StringBuilder();
 linkFetch3.Append("<fetch version=\"1.0\" output-format=\"xml-platform\" mapping=\"logical\" distinct=\"true\">");
 linkFetch3.Append("<entity name=\"cref8_cursist\">");
 linkFetch3.Append("<attribute name=\"cref8_fullname\"/>");
 linkFetch3.Append("<attribute name=\"cref8_cursistid\"/>");
 linkFetch3.Append("<link-entity name=\"cref8_opleiding_cref8_cursist\" from=\"cref8_cursistid\" to=\"cref8_cursistid\" visible=\"false\" intersect=\"true\">");
 linkFetch3.Append("<filter type=\"and\">");
 linkFetch3.Append($"<condition attribute=\"cref8_opleidingid\" operator=\"eq\" value=\"{trainingID}\"/>");
 linkFetch3.Append("</filter>");
 linkFetch3.Append("</link-entity>");
 linkFetch3.Append("</entity>");
 linkFetch3.Append("</fetch>");

//GET ROLES IN FOR EACH CURSISTS LOOP 
StringBuilder linkFetch4 = new StringBuilder();
 linkFetch4.Append("<fetch version=\"1.0\" output-format=\"xml-platform\" mapping=\"logical\" distinct=\"true\">");
 linkFetch4.Append("<entity name=\"cref8_rol\">");
 linkFetch4.Append("<attribute name=\"cref8_name\"/>");
 linkFetch4.Append("<link-entity name=\"cref8_cursist_cref8_rol\" from=\"cref8_rolid\" to=\"cref8_rolid\" visible=\"false\" intersect=\"true\">");
 linkFetch4.Append("<filter type=\"and\">");
 linkFetch4.Append($"<condition attribute=\"cref8_cursistid\" operator=\"eq\" value=\"{c.SelectToken("cref8_cursistid")}\"/>");
 linkFetch4.Append("</filter>");
 linkFetch4.Append("</link-entity>");
 linkFetch4.Append("</entity>");
 linkFetch4.Append("</fetch>");

Best Regards,

Anthony

I have the same question (0)
  • Guido Preite Profile Picture
    1,488 Super User 2024 Season 1 on at

    did you try to build the query with FetchXML Builder?

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard