Sdfdataset Component lazarus / 31-LCL ---------------------------------------------------------------------- vonskie · 2014-03-05 16:02 Have the following text file all fields are tab delimited First line is the column name Second line is the measurement type third line data starts How would I set up the component? Would I tell it the first line is the schema? How would I setup fielddefs? What does filtered setting do? How would the schema look for the tstring box? I can find no example or faq on its use or no doc. Please assist. Time           Date            CH1        CH2        CH3                °C         °C         °C         °C           08:49:57   3/4/2014    4.2000e+000    1.9300e+001   -1.4800e+001    09:04:57   3/4/2014    4.6000e+000    1.8900e+001   -1.4900e+001    09:19:57   3/4/2014    4.4000e+000    1.8400e+001   -1.5200e+001    09:34:57   3/4/2014    4.6000e+000    1.8900e+001   -1.5000e+001    09:49:57   3/4/2014    4.5000e+000    1.9000e+001   -1.5200e+001 ---------------------------------------------------------------------- howardpc · 2014-03-05 20:41 Quote from: vonskie on March 05, 2014, 05:02:53 pmHow would I set up the component? Code: [Select]  sdf.FirstLineAsSchema:=True;   sdf.FileMustExist:=True;   sdf.Delimiter:=#9;   sdf.FileName:='yourfilename.txt';  QuoteWould I tell it the first line is the schema? Yes. However, note that your second line of data is really metadata, and would be part of a more complex schema if 'schema' were not restricted to one line. So although the TSDFDataset will read the second line data OK, if displayed in a DBGrid the values shown would not correspond to the column titles. QuoteHow would I setup fielddefs? There is no need to do this since you provide a schema, so the TSDFDataset component parses the first data line and sets up fielddefs for you. QuoteWhat does filtered setting do? It enables you to make use of the OnFilterRecord event to process in- memory data QuoteHow would the schema look for the tstring box? I don't understand your question. ---------------------------------------------------------------------- BigChimp · 2014-03-06 10:29 Quote from: vonskie on March 05, 2014, 05:02:53 pmI can find no example or faq on its use or no doc. http://wiki.freepascal.org/Lazarus_Database_Overview#TSdfDataset_and_T FixedDataset No idea if the linked example is current/needs updates. It seems to set both schema as well as get the schema from the file, which as Howard says shouldn't be necessary.