Friday, February 28, 2020
JQuery to create Download Link
Simple way to download file without navigating.
function downloadFile(filePath){ var link=document.createElement('a'); link.href = filePath; link.download = filePath.substr(filePath.lastIndexOf('/') + 1); link.click(); } downloadFile('filepath/myfile.xlsx');
Monday, February 17, 2020
Convert CSV data to JSON
CSV Data
Convert CSV to JSON
Output as JSON
JSON Group by count, output to key value pair json result
Following is the JSON and need to manipulate it in format to groupBy.
var rows = [ { 'createdDate': '3/11/2016', 'createdBy': 'Bob' }, { 'createdDate': '3/12/2016', 'createdBy': 'Megan' }, { 'createdDate': '3/12/2016', 'createdBy': 'Bob' }, { 'createdDate': '3/13/2016', 'createdBy': 'Sam' }, { 'createdDate': '3/11/2016', 'createdBy': 'Bob' }, ]; var occurences = rows.reduce(function (r, row) { r[row.createdBy] = ++r[row.createdBy] || 1; return r; }, {}); var result = Object.keys(occurences).map(function (key) { return { key: key, value: occurences[key] }; }); console.log(result);
Newer Posts
Older Posts
Home
Subscribe to:
Posts (Atom)