cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bran
New Member

At what point is a FetchXML query actually executed with liquid?

II would like to create a liquid template that contains all of my fetchXML functions I'll use throughout the portal. I want to include this template on every page and within the page retrieve the values I need for that specific page. 

 

If I were to make a template that contains all of my fetchXML functions and include it on each page, will they all be executed each time? Or are they only executed when I use the xxx.results.entities and assign it to a variable? 

 

Having them all on one page makes it a lot more organized rather then having fetchXML spread out on all my pages. 

1 ACCEPTED SOLUTION

Accepted Solutions
OliverRodrigues
Super User
Super User

Hi @bran 

The FetchXML only retrieves the data once you invoke the xxx.results.entities 

So it shouldn't have any major performance impact having a single Web Template with lots of FetchXML, a few things to have in mind:

 

  • this would load several objects in memory, so the web app itself would be heavier
  • those would be cached as well, so the internal caching database would be larger
  • I haven't tested here how you would access the Fetch object from different pages, but I am assuming you have that figured out already
  • try to come up with a nice naming convention for those fetches, just so they don't conflict with anything else from your pages



If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Power Apps Portals Super User


Oliver Rodrigues


 

View solution in original post

3 REPLIES 3
OliverRodrigues
Super User
Super User

Hi @bran 

The FetchXML only retrieves the data once you invoke the xxx.results.entities 

So it shouldn't have any major performance impact having a single Web Template with lots of FetchXML, a few things to have in mind:

 

  • this would load several objects in memory, so the web app itself would be heavier
  • those would be cached as well, so the internal caching database would be larger
  • I haven't tested here how you would access the Fetch object from different pages, but I am assuming you have that figured out already
  • try to come up with a nice naming convention for those fetches, just so they don't conflict with anything else from your pages



If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Power Apps Portals Super User


Oliver Rodrigues


 

Perfect. I didn't consider the memory aspects of it. It will be a max of maybe 10 or so fetchXML functions on the page. I'm coming from PHP and I'm used to having on my db functions in a consolidated file that I can then pick from when needed. Thanks!

Fubar
Solution Sage
Solution Sage

Rather than putting all queries in one template, I would probably break them up into multiple templates and then "Include" the ones I wanted in Liquid e.g. if xxx then include template A else Include template B (can also do switch).

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Users online (1,478)