Page 1 of 1

How to avoid "Duplicate name in TFieldDefs" in virtualtable

Posted: Sun 22 Feb 2015 13:51
by tcflam
Hi all,

How can avoid "Duplicate name in TFieldDefs" in virtualtable? The following is my code:

VirtualTable1.ClearFields;
VirtualTable1.FieldDefs.Clear;

Thanks!

Re: How to avoid "Duplicate name in TFieldDefs" in virtualtable

Posted: Mon 23 Feb 2015 15:48
by azyk
We couldn't reproduce the problem. Please try reproduce the problem on our SdacDemo project - and let us know the results. The SDACDemo project is in the "Demos\SDACDemo\" folder relatively to the SDAC projects installation path.

Re: How to avoid "Duplicate name in TFieldDefs" in virtualtable

Posted: Tue 24 Feb 2015 08:58
by tcflam
I'm using dynamic create field. Can I check the field is exist before create the field?

Thanks!

Re: How to avoid "Duplicate name in TFieldDefs" in virtualtable

Posted: Tue 24 Feb 2015 11:15
by azyk
You can check whether a field with such name exists, for example, using the TVirtualTable.FieldDefs.IndexOf method. See more details about this method in the Embarcadero documentation: http://docwiki.embarcadero.com/Librarie ... on.IndexOf .