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

Filtering CAML query in Send HTTP Request

Hi all,

 

I'm using the Send an HTTP request to SharePoint action in my flow to collect an aggregate (AVG) from a SharePoint list.

 

I was wondering if there's any way to amend the CAML query to filter by View (or even better, the value of a particular column, e.g. a column called "Work Type" with a value called "OA Simulation").

 

This is what I have currently. I am not overly familiar with CAML queries but it was the best method to obtain the average from what I could find online.

lizwharty_0-1656044333718.png

I also copied the process off this video.

 

Thanks!

1 REPLY 1
Expiscornovus
Super User
Super User

Hi @lizwharty,

 

If it helps I can share an example with you.

 

Lets say you have the list below with a view that is grouped by work type, totals avg on OA Simulation. And you are after the average values of OA simulation.

 

camlquery_avg.png

In that case you could use the following Body value:

{
"parameters": {       
          "RenderOptions":5707271,       
          "OverrideViewXml":"<Query><GroupBy><FieldRef Name=\"WorkType\" Ascending=\"TRUE\" /></GroupBy></Query><ViewFields><FieldRef Name=\"LinkTitle\" /><FieldRef Name=\"WorkType\" /><FieldRef Name=\"OASimulation\" /></ViewFields><RowLimit Paged=\"TRUE\">30</RowLimit><Aggregations Value=\"On\"><FieldRef Name=\"OASimulation\" Type=\"AVG\" /></Aggregations><JSLink>clienttemplates.js</JSLink><XslLink Default=\"TRUE\">main.xsl</XslLink><Toolbar Type=\"Standard\"/></View>",
            "AddRequiredFields":true                        
                     }
}

 

camlquery_avg02.png

 

In your output you will see the avg values listed. 

 

avg_agg.png

 

Hope this helps a bit?

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (1,830)