cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Returning one value like groupby function

Hello Everyone

 

We are moving our back end from Sql to Common Data service

I have developed a Powerapp which used a sql View which would return one value (ie similar to a groupby function) from a group of records

Example

GUID                      OBSERVATION DATE                        Result             Submitted By            Question
1234                         10-08-2020                                    yes                  me@help.com           Q1a

1234                          10-08-2020                                    no                  me@help.com            Q1b

1234                          10-08-2020                                   no                   me@help.com           Q1c

 

I was able to create a view in SQL and in that view I had the GUID and observation Date and the submitted by in one row

and therefore itwould return

 

GUID                     OBSERVATION DATE                Submitted by

1234                      10-08-2020                                me@help.com

and then I would use it in my powerapp


I would like to know how can I do that in the common data service

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User II
Super User II

Hi @mpezzutti,

You can achieve that with FetchXml queries. Below is an example. More on FetchXml groupby: https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/use-fetchxml-

 

 

<fetch distinct="false" mapping="logical" aggregate="true" >
  <entity name="entity" >
    <attribute name="ID" alias="Guid" groupby="true" />
    <attribute name="observationdate" alias="ObervationDate" groupby="true" />
    <attribute name="submittedby" alias="SubmittedBy" groupby="true" />
  </entity>
</fetch>

 

 

There's a tool in XrmToolBox called FetchXmlBuilder to facilitate building your FetchXml queries and also View Designer tool to build/edit a CDS views. You can create a CDS view with that FetchXML and then (I haven't tried this but it should work) in your Canvas App, reference that view from your data source. Here's an article on this for more: info: https://www.inogic.com/blog/2019/10/show-dynamics-365-crm-views-in-canvas-app-using-cds/

Hope this helps!

View solution in original post

1 REPLY 1
Highlighted
Super User II
Super User II

Hi @mpezzutti,

You can achieve that with FetchXml queries. Below is an example. More on FetchXml groupby: https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/use-fetchxml-

 

 

<fetch distinct="false" mapping="logical" aggregate="true" >
  <entity name="entity" >
    <attribute name="ID" alias="Guid" groupby="true" />
    <attribute name="observationdate" alias="ObervationDate" groupby="true" />
    <attribute name="submittedby" alias="SubmittedBy" groupby="true" />
  </entity>
</fetch>

 

 

There's a tool in XrmToolBox called FetchXmlBuilder to facilitate building your FetchXml queries and also View Designer tool to build/edit a CDS views. You can create a CDS view with that FetchXML and then (I haven't tried this but it should work) in your Canvas App, reference that view from your data source. Here's an article on this for more: info: https://www.inogic.com/blog/2019/10/show-dynamics-365-crm-views-in-canvas-app-using-cds/

Hope this helps!

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Users online (9,669)