Search code examples
delphidelphi-xe

How to add unique constraint on combination of two fields


I want to add unique constraint on combination of two fields design-time in ClientDataSet.

enter image description here

This works but it changes index in ascending order(by default) and mess my code,

I think, i want to add the constraint from here

enter image description here

but it's obviously wrong way to do it and i cant find any information on google for this topic.


Solution

  • Do what's on the first picture but specify semicolon separated field list in the DescFields property as well. That defines the fields of the index that will be sorted in descending order.