How to get sums of a num and values using data from 2 columns

How to get sums of a num and values using data from 2 columns

mmarzsmmarzs Posts: 12Questions: 4Answers: 0
edited July 2021 in DataTables

I currently use a function that gets the counts of values in a search applied table however I'd like to use data from a different column as the num value in this function. What is the best way to pull that data in?

I'd like the num value to be the corresponding row data from the column 'points-earned:name'

var counts = {};
var num = 1
chartTableData.column('constituent-type:name', { search: 'applied' })
    .data()
    .each(function (val) {
        if (counts[val]) {
            counts[val] += num;
        } else {
            counts[val] = num;
        }
    });

Answers

Sign In or Register to comment.