Get total record in report/chart page

Hello everyone,

I’m developing a plugin that can show total records of a chart in report/chart page.

But since the event of app.report.show 'd only have app_id and type properties so i could not retrieved that total record from it.

I 've try to send a request to kintone API to get the total but i couldn’t build the query param exactly. The method kintone.app.getQuery() or kintone.app.getQueryCondition() only show the query for normal page not report page.

Hello Minh!

Sorry if I’m reading this wrong, but so basically you are trying to create a GRAPH(Bar chart, line chart, etc.) to show the total NUMBER of records or
you want to put the Total Number of Records somewhere in the GRAPH while it is showing data of some other stuff?
If it is the first one, you don’t need to create a plugin to do so since you can do it by the existing options when creating a graph like below:

 Chart Type: Your choice
 Group by: Your choice
 Function: Count
 Filter: All records
 Sort by: Your choice

thank you for your sincere response.

yes, i want to put the total number of records somewhere in the graph

for example: 

i have 10 records of teams, which 'r  divided into different categories by Category_Field

When i create a graph without group_by option, it shows total number of records properply (10 records).

But when i choose Group By: Category_Field

It’s a chance that a certain number of reports has Category_Field = null, hence it’ll not be displayed on the graph. Consequently, the total number of record would be 6 or 7 ,etc. I couldn’t have any method to calculate that number though i could get the total number of records that filtered by the filter option through kintone api and getQueryCondition method.

 

Hello Minh!

Okay, I finally understand what you are trying to do here.

First of all, if you are trying to display the total on the graph, I would not recommend doing this on the report page because it would require you to use the DOM to modify the graph and cybozu will not guarantee your operation anymore.

Therefore, I recommend you creating your own graph on the record list page or the record page where you can obtain the DOM info through API (plus it would not have that much of effect from the cybozu update).

FYI, to create your own graph on the page other than the report, an external library such as chart.js is pretty useful when creating it.
The following page is in Japanese, but there are example scripts that you can read and understand how to create the graph.

https://developer.cybozu.io/hc/ja/articles/202982064