cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mpezzutti
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
EricRegnier
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
EricRegnier
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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,442)