Need help in Populating HTML Table from a file debbiswas on October 04, 2020 Hi All, Here am trying to retrieve data from text file and embed them to HTML table based on some condition. Below is the code which is written in... Read full post Submit Preview Dismiss Collapse Expand Edward Ellsworth Edward Ellsworth Edward Ellsworth Follow Misanthrope with a laptop Location Dystopia, USA Work Code Monkey Joined Jul 20, 2020 • Oct 4 '20 Dropdown menu Copy link Hide Try putting a console.log in your filter callback function to see what values it's actually fetching and comparing from the file. Collapse Expand debbiswas debbiswas debbiswas Follow I like to learn new languages and their applications ..then of course develop something out of it Location Pune Joined Nov 13, 2019 • Oct 5 '20 • Edited on Oct 5 • Edited Dropdown menu Copy link Hide Thanks Edward for reaching out. I see that it fetches exactly same values as in text file inside filter callback. Also its datatype is string for each values Collapse Expand Edward Ellsworth Edward Ellsworth Edward Ellsworth Follow Misanthrope with a laptop Location Dystopia, USA Work Code Monkey Joined Jul 20, 2020 • Oct 5 '20 Dropdown menu Copy link Hide So, if the values are exactly the same, the filtered array wouldn't be empty. I'd try adding more to the console.log statement. For example: console.log(value, value == "p"); If this outputs something like p, false then my guess is the value variable has a phantom space around it. You could test that with something like: console.log('xx' + value + 'xx'); If there's a phantom space, you should see something like "xxp xx" or "xx pxx" debbiswas debbiswas debbiswas Follow I like to learn new languages and their applications ..then of course develop something out of it Location Pune Joined Nov 13, 2019 • Oct 6 '20 Dropdown menu Copy link Hide Thank you Ellsworth for your response . I tried putting above checks and see that condition return false but strangely there is no phantom space even. Edward Ellsworth Edward Ellsworth Edward Ellsworth Follow Misanthrope with a laptop Location Dystopia, USA Work Code Monkey Joined Jul 20, 2020 • Oct 7 '20 Dropdown menu Copy link Hide Hmm. I'm curious, if you do console.log(lineByline) what does it display? Or maybe console.table(lineByline)? debbiswas debbiswas debbiswas Follow I like to learn new languages and their applications ..then of course develop something out of it Location Pune Joined Nov 13, 2019 • Oct 9 '20 Dropdown menu Copy link Hide thank you for your response. Attaching the response for console.log(line) , lineByline and console.table(lineByline) inn sequence. Collapse Expand manish srivastava manish srivastava manish srivastava Follow Director & CEO, GDP CHURN (P) Ltd. Loves coding . Supports open source by funding. Email manishfoodtechs@gmail.com Location India Work Director at Gdp churn pvt ltd Joined Aug 31, 2019 • Oct 4 '20 Dropdown menu Copy link Hide Is TXT file was a table or database? Or paragraph.... And how many such files you need to convert? Collapse Expand debbiswas debbiswas debbiswas Follow I like to learn new languages and their applications ..then of course develop something out of it Location Pune Joined Nov 13, 2019 • Oct 4 '20 Dropdown menu Copy link Hide Thanks Manish. Text file will always contain one column data and only one file need to be converted. Collapse Expand manish srivastava manish srivastava manish srivastava Follow Director & CEO, GDP CHURN (P) Ltd. Loves coding . Supports open source by funding. Email manishfoodtechs@gmail.com Location India Work Director at Gdp churn pvt ltd Joined Aug 31, 2019 • Oct 5 '20 Dropdown menu Copy link Hide May be this is not best answer but it may solve your problem. Open your text file with ms Excel with limiting tab . You will see all your text column in first column on excel sheet. Now, you can work on this textfile and save it either SQL or text file which will be easy to get modified results with your jQuery codes. Ms Excel is superb program. It helped me in many cases. Code of Conduct • Report abuse
Try putting a console.log in your filter callback function to see what values it's actually fetching and comparing from the file.
Thanks Edward for reaching out. I see that it fetches exactly same values as in text file inside filter callback. Also its datatype is string for each values
So, if the values are exactly the same, the filtered array wouldn't be empty. I'd try adding more to the console.log statement. For example:
If this outputs something like p, false then my guess is the value variable has a phantom space around it. You could test that with something like:
If there's a phantom space, you should see something like "xxp xx" or "xx pxx"
Thank you Ellsworth for your response . I tried putting above checks and see that condition return false but strangely there is no phantom space even.

Hmm. I'm curious, if you do console.log(lineByline) what does it display? Or maybe console.table(lineByline)?
thank you for your response. Attaching the response for console.log(line) , lineByline and console.table(lineByline) inn sequence.
Is TXT file was a table or database? Or paragraph.... And how many such files you need to convert?
Thanks Manish. Text file will always contain one column data and only one file need to be converted.
May be this is not best answer but it may solve your problem.
Open your text file with ms Excel with limiting tab . You will see all your text column in first column on excel sheet.
Now, you can work on this textfile and save it either SQL or text file which will be easy to get modified results with your jQuery codes.
Ms Excel is superb program. It helped me in many cases.