Field-Map Scripting

4.15.7 AddLookupList

AddLookuplist procedure


Prototype:

procedure AddLookuplist(const Label_ :string; const LookupTable_ :TTableWrapper;

                       const IDAttribute_,ValueAttribute_ :string; const Value_ :variant);

Description:

Adds a field into the value dialog to get a value from a lookup list

Syntax:

vDlg.AddLookuplist(Label,Size,Value);


Part

Description


vDlg

A reference to an instance of a TValueDialogWrapper


Label

Variable declared as string. It represents the label of the input field


LookupTable

Variable declared as TTableWrapper. It represents the table from which the value will be selected


IDAttribute

Variable declared as string. It represents the filed with ID


ValueAttribute

Variable declared as string. It represents the field with value


Value

Variable declared as variant. It represents the input value


See also:

Create, Free, AddHeader, AddInteger, AddFloeat, AddString, AddLookuplist, AddDate, InputValues, Value, ValueByLabel


Example:

var 
  vdlg :TValueDialogWrapper;
  lkpSpecies,lkpDeadTree:TTableWrapper;
  choice : variant; 
begin
  lkpSpecies:=Trees.GetLookupTable('Species');
  lkpDeadTree:=Trees.GetLookupTable('DeadTree');
  
  vdlg:=TValueDialogWrapper.Create;
  try
    vdlg.AddLookupList('Species',lkpSpecies,'ID','Value1',null);
    vdlg.AddLookupList('Dead tree',lkpDeadTree,'ID','Value1',null);
    if vdlg.InputValues('Select values') then begin
      // do something
      ShowMessage(format('Selected species value: %s',[vdlg.ValueByLabel('Species')]));
      ShowMessage(format('Selected dead tree value: %s',[vdlg.Value[1]]));
    end;
   finally
     vdlg.Free;
     lkpDeadTree.Free;
     lkpSpecies.Free;
   end;
end.