Avatar

total by select " gaia-argoui-select" ( option pick in gaia-argoui-app-viewtoggle)

NDC ELOG

hello anyone,

This code just get all records in index show page. 

 

//call api records return from server
function fetchRecords(appId, opt_offset, opt_limit, opt_records) {
var offset = opt_offset || 0;
var limit = opt_limit || 100;
var allRecords = opt_records || [];
var params = { app: appId, query: 'limit ' + limit + ' offset ' + offset };
return kintone.api('/k/v1/records', 'GET', params).then(function (resp) {

allRecords = allRecords.concat(resp.records);
if (resp.records.length === limit) {
return fetchRecords(appId, offset + limit, limit, allRecords);
}
var tong = 0;
allRecords.forEach(function (item, index) {
tong += Number(item.見積小計.value);
//外注見積小計,機材見積小計
console.log(item.外注見積小計.value);
console.log(item.機材見積小計.value);

// tong += Number(item.機材見積小計.value);
});
return tong;
});
}

- but my prolems is i trust want to get total of these records went i pick in class " gaia-argoui-select-label"  or "gaia-argoui-select " and count sum it.

-- please help me understanr or give me some API---

Follow 3 followers
0

5 comments

Avatar
吉田 0 votes

in cosole.log, i just only get 40 records, while my list have 43 records? help me get 43 records Sir, thank you so much.

0
Comment actions Permalink
Avatar
Sean Tachibana 0 votes

Hi NDC, 

 

I wanted to make sure what you are trying to do is get the records displayed under the conditions you selected in the list.
Am I correct?

 

The relevant process is for retrieving all records.
If you want to retrieve the records through the API, you can specify the query condition to get the records that match the condition.
If you specify each list's query condition, you can get the records that match the condition by specifying the query.

 

If you knew that you need to set up the query,
and you want to change the value you get based on the list you are selecting, you may do the following;

 

1. Determine the list
2. Create a request based on the filtering criteria set in the list.
3. Record retrieval by API execution

 

As for which list you are selecting, you can determine from the viewID.

 

Display record data in a custom view:
https://developer.kintone.io/hc/en-us/articles/900000010623-Display-record-data-in-a-custom-view

 

For creating a request based on the filtering criteria set in the list, there are a couple of ways to do this.
In the simple method, you have to write the conditions for the list in the code beforehand.
In an easy way, you can use the following API to obtain the conditions to narrow down the list of records and make a request.

 

Get Record List:
https://developer.kintone.io/hc/en-us/articles/213148937-Get-Record-List

 

Hopefully, this helps.

0
Comment actions Permalink
Avatar
NDC ELOG 0 votes

Dear Sean Tachibana,

yes, i know this but i dont know "Create a request based on the filtering criteria set in the list." 

this image is my ID, and i want to filter each my option

0
Comment actions Permalink
Avatar
Sean Tachibana 0 votes

Hi NDC,

 

>i know this but i dont know "Create a request based on the filtering criteria set in the list."

 

Were you able to check the help page I sent you last?
There are couple of ways to create a request based on the filtering criteria set in the list.
One is to write the conditions for the list in the code beforehand or
you can use the following API to obtain the conditions to narrow down the list of records and make a request.

 

Get Record List:
https://developer.kintone.io/hc/en-us/articles/213148937-Get-Record-List

 

Display record data in a custom view:
https://developer.kintone.io/hc/en-us/articles/900000010623-Display-record-data-in-a-custom-view

 

>this image is my ID, and i want to filter each my option

 

As for this one, please refer to the following page.
A ViewID, a unique ID given to the view, would be necessary to determin the list.
ViewID could be found in the custom view settings screen.

 

Create a custom view:
https://developer.kintone.io/hc/en-us/articles/115002436434-Create-a-custom-view

 

Hopefully, this helps.

0
Comment actions Permalink