Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread EWB and Text File handling
Wed, Jan 3 2024 3:45 AMPermanent Link

Paul Coshott

Avatar

I know I can choose a local text file using a TFileComboBox. I would like to open a csv file and load the fields into a dataset. Is this possible? And if so, how can I do it?

Thanks,
Paul
Wed, Jan 3 2024 8:16 AMPermanent Link

erickengelke

Avatar

Paul Coshott wrote:

> I know I can choose a local text file using a TFileComboBox. I would like to open a csv file and load the
> fields into a dataset. Is this possible? And if so, how can I do it?

Yes, it's doable.

The easy way is with my Nice library: https://erickengelke.com/nice

  io := TFileIO.Create( self );

  // next three lines load the filesaver API and notify the user if it fails
  io.scriptfilesaver.OnError := LoadScriptError;
  io.scriptfilesaver.OnLoad := LoadScriptSuccess;
  io.LoadFileSaver;

  // this upcalls your onreadload() function with the file when it is uploaded
  io.setupfilecombobox( FileComboBox1, onreadload );

But if you want to roll it yourself, which takes some experimentation, look into FileSaver.JS on the web.

Erick
EWB Programming Books and Nice Component Library
See my EWB BLOG posts, at:
http://www.erickengelke.com
Wed, Jan 3 2024 10:34 PMPermanent Link

Paul Coshott

Avatar

erickengelke wrote:

>>The easy way is with my Nice library: https://erickengelke.com/nice
>>
>>   io := TFileIO.Create( self );

Thanks Erick. I'll have a look using your components.

Cheers,
Paul
Image