Index: src/base/db.pas
===================================================================
--- src/base/db.pas	(revision 11896)
+++ src/base/db.pas	(working copy)
@@ -244,14 +244,16 @@
   { TLookupList }
 
   TLookupList = class(TObject)
-  private
+  protected
     FList: TList;
   public
     constructor Create;
     destructor Destroy; override;
     procedure Add(const AKey, AValue: Variant);
     procedure Clear;
+    function FirstKeyByValue(const AValue: Variant): Variant;
     function ValueOfKey(const AKey: Variant): Variant;
+    procedure ValuesToStrings(AStrings: TStrings);
   end;
 
   { TField }
@@ -2315,6 +2317,19 @@
   FList.Clear;
 end;
 
+function TLookupList.FirstKeyByValue(const AValue: Variant): Variant;
+var
+  i: Integer;
+begin
+  for i := 0 to FList.Count - 1 do
+    with PLookupListRec(FList[i])^ do
+      if Value = AValue then begin
+        Result := Key;
+        exit;
+      end;
+  Result := Null;
+end;
+
 function TLookupList.ValueOfKey(const AKey: Variant): Variant;
 
   Function VarArraySameValues(VarArray1,VarArray2 : Variant) : Boolean;
@@ -2347,6 +2362,18 @@
   if i >= 0 then Result := PLookupListRec(FList.Items[I])^.Value;
 end;
 
+procedure TLookupList.ValuesToStrings(AStrings: TStrings);
+var
+  i: Integer;
+  p: PLookupListRec;
+begin
+  AStrings.Clear;
+  for i := 0 to FList.Count - 1 do begin
+    p := PLookupListRec(FList[i]);
+    AStrings.AddObject(p^.Value, TObject(p));
+  end;
+end;
+
 procedure DisposeMem(var Buffer; Size: Integer);
 begin
   if Pointer(Buffer) <> nil then
