I have data in which there are arrays. in the array, there is a value which is claimed_value. I need the sum of all claimed_value of arrays. an example I have array all have the claimed_value. but I need to sum of all the claimed_value which have the status=settled in the array.
this is how I'm calling the API.
getClaims(){
if(this.userFilter.company_id){
let url =
'http://api.igiinsurance.com.pk:8888/insurance_IGItakaful/insurance-
api/get_claims.php?company_id='+this.userFilter.company_id;
}else{
let url =
'http://api.igiinsurance.com.pk:8888/insurance_IGItakaful/insurance-
api/get_claims.php?offset=0&limit=200';
}
this.clientData = this.httpClient.get(url).
subscribe(data => {
console.log(data);
this.data = data.records;
var status = 'settled';
var status2 = 'submitted';
var countsettled = this.data.filter((obj) => obj.status ===
status).length;
var countunsettled = this.data.filter((obj) => obj.status ===
status2).length;
console.log(countsettled);
this.countsettled = countsettled;
console.log(countunsettled);
this.countunsettled = countunsettled;
});
}
