Recent

Author Topic: No decent tutorial for the Tdrawgrid - need to output millions of data  (Read 8833 times)

mas steindorff

  • Hero Member
  • *****
  • Posts: 532
I did not find the code I had created... too bad, I had some other cool stuff in it..  But fundamentally it is: (done by hand so may have error)
Code: Pascal  [Select][+][-]
  1. fhandle :textfile;
  2. TStr: Tstringlist or like
  3. ...
  4. procedure fmain.mySaveToFile(filename:string);
  5. var str:string
  6.   i:interger;
  7. begin
  8.    AssignFile(fhandle,filename);
  9.    if fileExist(Filename) then
  10.        // does user wish to append or overwrite...
  11.    // Append or ReWrite(fhandle) ...
  12.  // add headers...
  13. //  main save
  14.    for i:= 0 to Tstr.count-1 begin
  15.       str := Tstr.string[i];         // get the line
  16.       writeln(fhandle,str);       // write the line
  17.       // if this is some sort of a back ground task...
  18.       if (i mod 1000) then
  19.           Application.process Messages;
  20.       // update  progress bar if you use one ...
  21.       end; // of for loop
  22.    closefile(fhandle);
  23. end;
  24.  
  25.  
windows 10 &11, Ubuntu 21+ - fpc 3.0.4, IDE 2.0 general releases

teochris

  • Jr. Member
  • **
  • Posts: 86
I would implement some paging mechanism here to display reasonable amount of data at a time in a grid.
And I would not even try to load all those data into memory, rather I would store them in a large file on disk and then read the given chunk into memory.
TFileStream should be able to do it, or see here: http://stackoverflow.com/questions/4615286/what-is-the-fastest-way-for-reading-huge-files-in-delphi

Your idea sounds really good but I am afraid I do not have such experience to do this kind of coding and I cannot find detailed tutorial for it! If you have something similar ready and you wish to shere it with us I maybe able to replicate it for my needs.

I have a huge question about Lazarus knowledge that some of the expert users have - I do not know how I can gain this knowledge for Lazarus since there are no detailed tutorials for the most functions - I do know If I should have read more before started using Lazarus - I want to become an expert in Lazarus also BUT I do not know how I can do so!


howardpc

  • Hero Member
  • *****
  • Posts: 4144
These data will not have any real use, I just want them to be shown to users because this will add a feature that similar programs like mine do not have at all and users of my app requested it from me

What advantage is a useless feature? Similar programs omit this functionality because it is absurd. No one will waste time scrolling painfully slowly amongst 150 million cells in a grid to find data of interest, even the person(s) who asked for it.
Far better would be to implement a filter or search function that would locate data of interest without labouring to possibly also display tens of millions of unwanted cells.
« Last Edit: June 01, 2016, 12:47:56 pm by howardpc »

tk

  • Sr. Member
  • ****
  • Posts: 361
If you have something similar ready and you wish to shere it with us I maybe able to replicate it for my needs.

These were only my ideas, have never had the need to do something like this. More common is to use a database engine for storing such amount of data records and a dbgrid to display them. Paging mechanism could be then made with simple SQL commands.
If you are an absolute beginner and don't know the basics I would start with reading some book. Personally I've started with book Mastering Delphi long time ago, you could start with similar newer book specific to Lazarus (see http://wiki.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines). Not everything you will find in a book but believe me it is a good start.
« Last Edit: June 01, 2016, 02:44:19 pm by tk »

teochris

  • Jr. Member
  • **
  • Posts: 86
If you have something similar ready and you wish to shere it with us I maybe able to replicate it for my needs.

These were only my ideas, have never had the need to do something like this. More common is to use a database engine for storing such amount of data records and a dbgrid to display them. Paging mechanism could be then made with simple SQL commands.
If you are an absolute beginner and don't know the basics I would start with reading some book. Personally I've started with book Mastering Delphi long time ago, you could start with similar newer book specific to Lazarus (see http://wiki.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines). Not everything you will find in a book but believe me it is a good start.

Your book suggestions seems a big help for me - very soon I will start reading them - never done so in the past - I just learned pascal because I am a good mathematician and in the beginning of my programming I was looking for code in google to help me solve mathematical problems with pascal!

 

TinyPortal © 2005-2018