unit UPegaUnidade;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls,
  FMX.ListView.Types, FMX.ListView.Appearances, FMX.ListView.Adapters.Base,
  Data.Bind.EngExt, Fmx.Bind.DBEngExt, System.Rtti, System.Bindings.Outputs,
  Fmx.Bind.Editors, Fmx.Bind.GenData, Data.Bind.GenData, Data.Bind.Components,
  Data.Bind.ObjectScope, FMX.ListView, Data.Bind.DBScope, Data.DB,
  Datasnap.DBClient, Data.DbxSqlite, Data.FMTBcd, Datasnap.Provider,
  Data.SqlExpr, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Param,
  FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf, FireDAC.DApt.Intf,
  FireDAC.Comp.DataSet, FireDAC.Comp.Client, uDWConstsData, uRESTDWPoolerDB;

type
  TFPegaUnidade = class(TForm)
    ListView1: TListView;
    SterlingStyleBook: TStyleBook;
    RESTDWClientSQL1: TRESTDWClientSQL;
    BindSourceDB1: TBindSourceDB;
    BindingsList1: TBindingsList;
    LinkListControlToField1: TLinkListControlToField;
    procedure ListView1ItemClick(const Sender: TObject;
      const AItem: TListViewItem);
    procedure FormActivate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    Selecionado: String;
  end;

var
  FPegaUnidade: TFPegaUnidade;

implementation

{$R *.fmx}

procedure TFPegaUnidade.FormActivate(Sender: TObject);
begin
  RESTDWClientSQL1.Active := False;
  RESTDWClientSQL1.Active := True;
end;

procedure TFPegaUnidade.ListView1ItemClick(const Sender: TObject;
  const AItem: TListViewItem);
begin
  Selecionado := RESTDWClientSQL1.FieldByName('ID').AsString + '|' + RESTDWClientSQL1.FieldByName('SIGLA').AsString;
  Close;
end;

end.
