program FldType;
uses PXEngine, WinCrt;

const TableName = 'Table';

type NameString = array[0..24] of char;

var   PxErr: Integer;
      TblHandle: TableHandle;
      FldHandle: FieldHandle;
      FieldType: NameString;

procedure PX(Code : integer);
begin
  writeln(PXErrMsg(Code));
end;

begin
  PX(PXWinInit('MyApp', pxShared));
  PX(PXTblOpen(TableName, TblHandle, 0, False));
  PX(PXFldHandle(TblHandle, 'Currency Field', FldHandle));

  (* Get field type from field handle *)
  PxErr := PXFldType(TblHandle, FldHandle, 20, FieldType);
  if PxErr <> PxSuccess then
    Writeln(PxErrMsg(PxErr))
  else Writeln('Field handle ', FldHandle, ' has field type of ', FieldType);

  PX(PXTblClose(TblHandle));
  PX(PXExit);
end.
