How to import data from a tab delimited text file (links.txt)

How to import data from a tab delimited text file (links.txt)

cand1cecand1ce Posts: 1Questions: 1Answers: 0

Hello.

I am a newbie.

Now, I have a text file (links.txt). And it looks like this:

dataA1 " /t " dataA2 " /t " dataA3
dataB1 " /t " dataB2 " /t " dataB3
dataC1 " /t " dataC2 " /t " dataC3
and so on.

How am I going to import that data to the DataTable successfuly?

I tried importing the data but Datatable failed to count the total number of rows, so everything is being shown in 1 page (300 records in 1 page).

I have read some solutions but most of them are in VB. Can't we have it in javascript?

Your response is greatly appreciated.

Answers

  • allanallan Posts: 63,791Questions: 1Answers: 10,513 Site admin

    Sure you can do it in Javascript - just Ajax load your data, then using Javascript to turn the file into an array of row information. For example split it on \n first to get the rows, then loop over it breaking the fields up into the individual field values (as arrays or objects).

    Then use data or rows.add() to add it to the database.

    Allan

This discussion has been closed.