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

Announcements

News and Announcements icon
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

  • Guido Preite Profile Picture
    1,490 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 232 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 202 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard