Closed WhiteG00se closed 1 year ago
Hello,
query_table
function has input_column_names
parameter which you can use to pass the column names: https://www.npmjs.com/package/rbql#rbqlquery_table
Thank you for the suggestion, this removed my need for regex to map the query.
So to my understanding it's not possible to have a 2D array that stores table header + table body. So instead I made my table an object that stores string array for the headers and the 2D array for the body. I suppose that's cleaner anyway. But it would have been less code had I been able to keep the header in the 2D array.
Hello there,
so when using the VS Code extension to query a csv file, it works flawless if the .csv has headers. When trying to query a 2D array in node.js, it's not going so well.
As far as I understood the docu on npm, I just need to add "WITH (header)" to the end of my query. Or does that only work with rbql.query_csv? Or do I perhaps need to pass it as an argument somehow? Is there maybe an alternative where I can query an array of objects instead of a 2D array (then the "headers" would just be the keys and not cause issues)?
Here's a code snippet where I use it (applyMappings turns the header (e.g. "hours") into columns (e.g. "a6")):
This keeps giving me "Error: At record 1, Details: Unable to convert value "hours" to a number." Well yes, the column with the hours has a string in the first row, because that's the header, and all the other values are numbers.
Is there an error on my end, or does it just not have this functionality?
BR Tobi