Knowledge Base Article
KB10377 - I want to show the user of my DK based application a selection list drawn up only from existing values in a database. How can this be done?
There is no direct way to do this. If you are using SQL database, you can query for DISTINCT field values. If you are using a file based layer, you can use a string list which has the distinct values.
lst_name := TStringList.Create ;
lst_name.Duplicates := False ;
lst_name.CaseSensitive := False ;
// do this only once
ll.MoveFirst( GisWholeWorld, '' )
while not ll.Eof do begin
try
lst_name.Add( ll.Shape.GetField( 'NAME' ) ) ;
except
// nothing - just duplicated value
end ;
ll.MoveNext ;
end ;
// and this on each attribute change
my_shape.SetField( 'NAME', some_value ) ;
try
lst_name.Add( my_shape.GetField( 'NAME' ) ) ;
except
// nothing - just duplicated value
end ;
Created: 2003-11-21, Modified: 2005-09-14
|