Recent

Author Topic: Possible bug in TCSVDataSet?  (Read 577 times)

egsuh

  • Hero Member
  • *****
  • Posts: 1002
Possible bug in TCSVDataSet?
« on: August 26, 2022, 12:41:21 pm »
I load up a CSV file to TCSVDataSet, and set it active.
Then, I go to CSVOptions of TCSVDataSet and set FirstLineAsFieldNames to true.
But then there occurs error --- it is not done.
I think the first column names --- Column1, Column2, ...  are not cleared.
In the FieldDefs of TCSVDataSet, column names are changed to first line, but if I right click on the TCSVDataSet icon and enter Edit Fields, the old field names are alive, and I cannot remove them.

Zvoni

  • Hero Member
  • *****
  • Posts: 1339
Re: Possible bug in TCSVDataSet?
« Reply #1 on: August 26, 2022, 02:46:40 pm »
Sample-Code?
What's the "Field"-Delimiter inside the CSV?
What did you set as Field-Delimiter in your TCSV-Object?
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

wp

  • Hero Member
  • *****
  • Posts: 10057
Re: Possible bug in TCSVDataSet?
« Reply #2 on: August 26, 2022, 02:52:50 pm »
When a dataset is active its structure cannot be changed any more. Therefore, I'd propose to FIRST set FirstLineAsFieldNames=true and THEN to set Active=true (untested).

Thaddy

  • Hero Member
  • *****
  • Posts: 11925
Re: Possible bug in TCSVDataSet?
« Reply #3 on: August 26, 2022, 05:17:29 pm »
That is the correct order.
Black themes should be banned.

wp

  • Hero Member
  • *****
  • Posts: 10057
Re: Possible bug in TCSVDataSet?
« Reply #4 on: August 26, 2022, 05:54:11 pm »
What is "that"? First set FirstLineAsFieldNames/second set Active, or first set Active/second set FirstLineAsFieldName?

Thaddy

  • Hero Member
  • *****
  • Posts: 11925
Re: Possible bug in TCSVDataSet?
« Reply #5 on: August 26, 2022, 06:19:26 pm »
FirstLineAsFieldNames then second set Active.
Active relies on the setup. You can find the proof in the sourcecode.
« Last Edit: August 26, 2022, 06:21:23 pm by Thaddy »
Black themes should be banned.

wp

  • Hero Member
  • *****
  • Posts: 10057
Re: Possible bug in TCSVDataSet?
« Reply #6 on: August 26, 2022, 07:32:29 pm »
Yes, I would have been very much surprised if it were the other way round.

egsuh

  • Hero Member
  • *****
  • Posts: 1002
Re: Possible bug in TCSVDataSet?
« Reply #7 on: August 27, 2022, 06:02:04 am »
Quote
When a dataset is active its structure cannot be changed any more. Therefore, I'd propose to FIRST set FirstLineAsFieldNames=true and THEN to set Active=true (untested).

Yes, it's the way that works. But hope there be a way to change the setting.

Thaddy

  • Hero Member
  • *****
  • Posts: 11925
Re: Possible bug in TCSVDataSet?
« Reply #8 on: August 27, 2022, 12:28:02 pm »
Yes, it's the way that works. But hope there be a way to change the setting.
Not on the same Tdataset, you will need another Tdataset for that is the easy way.
Black themes should be banned.

 

TinyPortal © 2005-2018