microsoft Dynamics CRM Group by - group-by

I have a list of customers (incl. data). Each customer is attached to a owner. See example below.
I would like to create a table in a dashboard (it is called a list in dynamics) where I summarize stats per user. Columns could be User - #meetings Q1 - #meetings Q2 - .... Total Revenue.
I have been unable to find anyway of doing a group by.
Any ideas?

basically you are looking for reporting ways, where you have data and you want to show/report it.
You have 3 ways.
create SSRS Report and embed it as Iframe or webresource in your dashboard.
In your ssrs report you can group by and do all sort of things basically done for reporting
Or create powerBI report and embed it as Iframe or webresource in your dashboard. With PowerBI you probably will need Pro license and so on.
You could also create PCF control/ custom html webresouce and show data required as grid with all your grouping and so on.
With SSRS you do not need any license as it is included out of boy.
With PCF/HTML grid you have higher code development but you have control what to show and how to show.

You can also create Rollup field on User entity and rollup fields for Stat 1 as sum on that field and count on account relationship.
See https://learn.microsoft.com/en-us/dynamics365/customerengagement/on-premises/customize/define-rollup-fields

FetchXML provides groupby capabilities.
This example counts the number of lines per quote:
<fetch distinct='false' mapping='logical' aggregate='true'>
<entity name='quotedetail'>
<attribute name='quoteid' alias='quotelinecount' aggregate='countcolumn' />
<attribute name='quoteid' alias='quoteid' groupby='true' />
<order alias="quotelinecount" descending="true" />
</entity>
</fetch>
If your org is online, the SQL endpoint is also available (in preview).

Related

Jasper report - getting duplicate records

We are exploring Jasper reports to replace our current reporting engine. Our data source will be REST APIs, and we'll be needing to join multiple tables. I came across the CData JDBC driver for REST, and it seemed apt for the purpose.
I have created a JDBC data adapter using the CData driver, with a JSON file as a source which has data for 2 entities - users and posts.
Then I created a report with this data adapter to display fields in a table. The data is a result of join query on both the entities as below -
SELECT users.name,users.username,users.email,users.website,posts.title FROM users join posts on users._id = posts.userId
Below is the data adapter configurations -
CDataDataAdapter.xml
<jdbcDataAdapter class="net.sf.jasperreports.data.jdbc.JdbcDataAdapterImpl">
<name>CDataDataAdapter</name>
<driver>cdata.jdbc.rest.RESTDriver</driver>
<username />
<password />
<savePassword>true</savePassword>
<url>jdbc:rest:Format="JSON";URI="D:/Documents/ToJasper/SampleJoinJson.json";XPath="/posts;/users";DataModel="Relational";JSONFormat="JSON";SSLServerCert="*";Logfile="D:\Documents\Tasks\ToJasper\cdata-driver.log";Verbosity="4";Location="D:\Documents\Tasks\ToJasper\Schema";FlattenObjects="False";GenerateSchemaFiles="OnStart";RowScanDepth="10";</url>
<database />
<serverAddress />
<classpath>I:\Program Files\CData\lib\cdata.jdbc.rest.jar</classpath>
<classpath>I:\Program Files\CData\lib\rssbus.jar</classpath>
</jdbcDataAdapter>
The data is fetched the rendered in the report, but the problem is it gets repeated.
The table is repeated in the report 5 times, 4 times with full data, and one time with only column headers. I cannot understand why, any help is greatly appreciated.
I got the answer here - https://community.jaspersoft.com/questions/904196/same-detail-shown-multiple-times-page-and-multiple-pagesireports-well-jaspersoft
I added the table component in the Detail band instead of Summary band. Quoting from the answer above -
"Where did you put the table and chart element in the report? They should be placed in SUMMARY section, not detail section. JR report detail band is called for each row fetched into report. If you have 100 rows, it will display information in the detail band 100 times each with details of that row. Tables and charts gather and tally all your data to display and should be placed in the summary band thus have them displayed only once."

Crystal report that auto-emails to vendors in Parameter

This is a little bit of a stretch, but we're trying to convert old reports in an increasingly unstable Access Database and I have a question.
Here's what the report does in Access currently:
The user gets prompted for one of our many Suppliers in a drop down style list
Once the supplier is entered, that Suppliers list of parts will be populated
The report then pulls an email address from our system (IFS) and emails the list that has been populated to the email in our files.
We've made a SQL Query that will pull in the information that we need to replicate the report, but we're at a sort of cross-roads with how to get it to automatically go through the list of Suppliers that are in the Parameters and send off the email to them all automatically.
Would there be an easier way to do this in Crystal Reports (2011) besides automating the report and selecting all the parameters manually or in Oracle SQL Developer through maybe a WHILE LOOP?
Thanks in advance, and if you need any more information, I'll try and clarify!
This looks like a data driven report ( publication). You will run a query to retrieve the list if suppliers and their emails then run a report for each record returned by the query. Let say you have a report , which accepts a parameter SupplierID and the query returns data like this
SupplierID SupplierEmail
ID=1 email=supplierA#mail.com
ID=2 email=supplierB#mail.com
ID=3 email=supplierC#mail.com
The software will get row #1 and will use ID=1, as a parameter for Suppliers report, will export the report and will send the exported file to supplierA#mail.com. Then it will move to the next row and will use ID=2 as a parameter for the next run of the same report, export it and send it to supplierB#mail.com. The same will happen for row #3. You can check also this video, which demonstrates the proces: http://www.r-tag.com/Pages/Preview_CreateBatchJob.aspx .
Because the values for report parameters, emails etc are returned by the query this approach is known as data driven report ( publication).
Data driven publications are available in SSRS if you own SQLServer Enterprise license. There are other types of software who support them. The sample video above is from R-Tag, which could be useful too and supports SSRS, Crystal reports and SQL Ad-hoc queries. If you use Ad-hoc query you can export suppliers data to Excel without creating a special report.

Jasper Subtotal

I have a report- from another question: Jasper report data summary which shows totals for a number of columns by location. I need to sub-total some of the location_cds and am not sure where to start. I have one group - by location_cd. Some location_cds have sub-locations, i.e. 3A has 3A1, 3A2, 3A3. Right now I have the totals for each individual row displayed in the group footer. I would like to see a subtotal for any location_cd that has sub-locations. I am trying to puzzle out how I am going to approach that. Should I see if I can do that in the query or will Jasper help me out here?
I am querying Sybase ASE 15.7.0 and am using Jasper Studio 5.5.1
Sub totals are the same as totals, just check the following:
add the order by corresponding to your list - usually add the item to the order by list
ORDER BY some_name_wharever, my_subtotal_thing_to_be_ordered
create a new group using the wizard, right click the root of the report on the report inspector and select "add report group"
create a new variable just like the total one but mind the reset and increment group
That should do it. Hope it helps. Good luck.
I feel like you are trying to create a crosstab, with different subtotals and a general total... Do try looking into crosstabs.. they may be tricky to use, but the end result is great if used properly!

Crystal report individual schedule run for each possible parameter values

I have a requirement to schedule individual run for a report for each possible database values for the customer parameter. So, if we have 1000 customers in the customer table. The report needs to run an instance for each customer value - i.e a 1000 versions. This needs to happen once a month. Please suggest on ways to accomplish this dynamically.
Create a Crystal Report that supplies id, full name, and email address (the names don't need to match):
Add report to Enterprise.
Create new Publication:
Select dynamic recipients, Crystal Reports, then the report that you published earlier:
Map the report's fields to the interface:
Configure Personalization:
You need a data driven reports - run a query and then run a report for each record returned by the query. Check R-Tag (www.r-tag.com). Their scheduler supports data driven reports. They have also a free community edition just for Crystal reports, which may support this feature too.

Run SSRS report for selected records from Javascript

In Dynamics CRM 2011 we can filter the records in the report by selecting records on homepage grid.
How can I start this report from JavaScript filtered by selected records?
I know how to run a report from JavaScript by it's ID and related record type. But I would also like to pre-filter the result.
I did once similar to this but using fetchxml report (not direct sql report).
There is a blog post for this: http://www.magnetismsolutions.com/blog/paulnieuwelaar/2011/12/18/Run_Fetch_XML_Report_on_Selected_Record_in_Dynamics_CRM_2011.aspx