In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
What's a good way to load substrings of a text file into a grid?
What's a good way to load substrings of a text file into a grid?
Hi, I just need the general approach, and what kind of grid to use.
So if we have a fixed-width text file with defined fields or a comma delimited file, what kind of grid should we use? Just a basic TListView?
How would you reccomend to navigate through the file? Just use the basic Harbour file functions?
So if we have a fixed-width text file with defined fields or a comma delimited file, what kind of grid should we use? Just a basic TListView?
How would you reccomend to navigate through the file? Just use the basic Harbour file functions?
- ignacio
- Site Admin
- Mensajes: 9252
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Re: What's a good way to load substrings of a text file into a grid?
Hi,
It depends on how you want the information to be seen. If is a typical row & columns data, I suggest you use a Browse. Is quite easy to move the data to an array with hb_tokens() functions. In case not, use a standard TMemo using a non proportional font, like Courier. If the file size is huge, consider using a TRichedit, since it handles large files better.
Regards,
It depends on how you want the information to be seen. If is a typical row & columns data, I suggest you use a Browse. Is quite easy to move the data to an array with hb_tokens() functions. In case not, use a standard TMemo using a non proportional font, like Courier. If the file size is huge, consider using a TRichedit, since it handles large files better.
Regards,
Re: What's a good way to load substrings of a text file into a grid?
Thanks ignaacio,
Yes, it would be viewed in columns of data.
Would we be using a Tbrowse or TArrayBrowse, or some other component?
If we use a browse, does the array get loaded a screen at a time? I'd be concerned about performance when the files are really large.
It would be read-only, not sure if that makes a difference.
Yes, it would be viewed in columns of data.
Would we be using a Tbrowse or TArrayBrowse, or some other component?
If we use a browse, does the array get loaded a screen at a time? I'd be concerned about performance when the files are really large.
It would be read-only, not sure if that makes a difference.
ignacio escribió: ↑Mié Dic 08, 2021 6:53 pm Hi,
It depends on how you want the information to be seen. If is a typical row & columns data, I suggest you use a Browse. Is quite easy to move the data to an array with hb_tokens() functions. In case not, use a standard TMemo using a non proportional font, like Courier. If the file size is huge, consider using a TRichedit, since it handles large files better.
Regards,
- ignacio
- Site Admin
- Mensajes: 9252
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Re: What's a good way to load substrings of a text file into a grid?
Hi,
When I say huge files, I mean files over 10 Mb, or so. Except those cases you surely will not detect any speed problem on converting that file into an array. In case the file is larger, I recommend to use a TBrowse, its navigation events and the harbour file functions: fopen(), fseek(), ....
Regards,
When I say huge files, I mean files over 10 Mb, or so. Except those cases you surely will not detect any speed problem on converting that file into an array. In case the file is larger, I recommend to use a TBrowse, its navigation events and the harbour file functions: fopen(), fseek(), ....
Regards,
Re: What's a good way to load substrings of a text file into a grid?
Ok, thanks Ignacio. Some of the files are at least a gig.
ignacio escribió: ↑Jue Dic 09, 2021 11:14 am Hi,
When I say huge files, I mean files over 10 Mb, or so. Except those cases you surely will not detect any speed problem on converting that file into an array. In case the file is larger, I recommend to use a TBrowse, its navigation events and the harbour file functions: fopen(), fseek(), ....
Regards,
- ignacio
- Site Admin
- Mensajes: 9252
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Re: What's a good way to load substrings of a text file into a grid?
Hi,
Then I suggest you treat them with just fOpen(), fSeek() and fClose() functions and a TBrowse control. The RecCount() surely will be the tricky part.
Regards,
Then I suggest you treat them with just fOpen(), fSeek() and fClose() functions and a TBrowse control. The RecCount() surely will be the tricky part.
Regards,
Re: What's a good way to load substrings of a text file into a grid?
I guess I'd want to start with the HB_F() functions, assuming that they behave well with Xailer.
https://vivaclipper.wordpress.com/tag/hb_fuse/
https://vivaclipper.wordpress.com/tag/hb_fuse/
Re: What's a good way to load substrings of a text file into a grid?
Ignacio,
Sorry, I can't locate a TBrowse component in any of the toolbox tabs. Should I just use the class directly?
The derived objects are there TArrayBrowse and TDBBrowse and such. But there's no base component TBrowse.
Sorry, I can't locate a TBrowse component in any of the toolbox tabs. Should I just use the class directly?
The derived objects are there TArrayBrowse and TDBBrowse and such. But there's no base component TBrowse.
- ignacio
- Site Admin
- Mensajes: 9252
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Re: What's a good way to load substrings of a text file into a grid?
No way. They are extremely slow:DC escribió: ↑Jue Dic 09, 2021 5:36 pm I guess I'd want to start with the HB_F() functions, assuming that they behave well with Xailer.
https://vivaclipper.wordpress.com/tag/hb_fuse/
- Memoread() loads the complete file to a memory string.
- Memoline() is the slowest function ever done.
You must NOT load the file into memory. You should only load chuncks of that file. That's the way.
Regards,
- ignacio
- Site Admin
- Mensajes: 9252
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Re: What's a good way to load substrings of a text file into a grid?
Hi,
Attached a sample using a browser class TTextBrowse that can handles any text file of any size, as long the OS can handle too.
With REALLY very large files, the function GetLines() can be slow. Moving that function to C surely will increase its speed. Another possibility is to use a TFuture for that code.
Regards,
Attached a sample using a browser class TTextBrowse that can handles any text file of any size, as long the OS can handle too.
With REALLY very large files, the function GetLines() can be slow. Moving that function to C surely will increase its speed. Another possibility is to use a TFuture for that code.
Regards,
- Adjuntos
-
- test.zip
- (3.62 KiB) Descargado 75 veces
Re: What's a good way to load substrings of a text file into a grid?
I didn't expect this. Thanks, Ignacio.
ignacio escribió: ↑Lun Dic 13, 2021 4:42 pm Hi,
Attached a sample using a browser class TTextBrowse that can handles any text file of any size, as long the OS can handle too.
With REALLY very large files, the function GetLines() can be slow. Moving that function to C surely will increase its speed. Another possibility is to use a TFuture for that code.
Regards,
- ignacio
- Site Admin
- Mensajes: 9252
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Re: What's a good way to load substrings of a text file into a grid?
Glad to help to active Xailer users. Thank you for your support.
Regards,