Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
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,488 Super User 2024 Season 1 on at
    Re: Combine two N:N FetchXML querys

    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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 109 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 82 Super User 2025 Season 1

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 72

Overall leaderboard