Forum Discussion
_anomDiebolt_
9 years agoQrew Elite
Here is the code to log the fid and field name to the console as a table display and as CSV:
Notes:
(1) This code uses widely supported ES6 features:
(2) underscorejs is used to map gTableInfo[gReqDBID].finfo into an array of arrays in the first instance and to reduce gTableInfo[gReqDBID].finfo to a CSV string in the second.
console.table(_.map(gTableInfo[gReqDBID].finfo, (field, fid) => { return [fid, field.name]; })); console.log(_.reduce(gTableInfo[gReqDBID].finfo, (memo, field, fid) => { return memo + '${fid},${field.name}\n'; }, "" ));
Notes:
(1) This code uses widely supported ES6 features:
- backticks for string interpolation
- fat arrow functions (ie =>)
(2) underscorejs is used to map gTableInfo[gReqDBID].finfo into an array of arrays in the first instance and to reduce gTableInfo[gReqDBID].finfo to a CSV string in the second.