EMS logo

Products Navigation

Advanced Data Import VCL

Our Partnership Status

Microsoft Certified Partner
Oracle Certified Partner
Embarcadero Technology Partner

Advanced Data Import for RAD Studio VCL

On-line Documentation

TQImport3.OnBeforePost

 

TQImport3                


 

type TImportBeforePostEvent = procedure(Sender: TObject; Row: TQImportRow; var Accept: boolean); of object;

 

property OnBeforePost: TImportBeforePostEvent;

 

Description

The OnBeforePost event takes place when the current table row is already delivered from the source table but not posted to the ImportDestination yet (if ImportDestination is not qidUserDefined). Row is the list containing of field names and values and allowing you to change the field value in the current row before it is posted. The Accept parameter defines if the current row is imported or not.

 

In the example below all the country names are imported in upper case and all the rows with population more than 10 000 000 are not imported at all.

 

procedure QImport1.BeforePost(Sender: TObject; Row: TQImportRow; var Accept: boolean);

var

  i: integer;

begin

  for i := 0 to Row.Count - 1 do begin

    if Row[i].Name = 'Country' then begin

      Row[i].Value := AnsiUpperCase(Row[i].Value);

      Continue;

    end;

    if (Row[i].Name = 'Population') and (StrToInt(Row[i].Value) > 10000000) then begin

       Accept := False;

       Break;

    end;

  end;

end;

 

 


See also:

OnAfterPost event

OnUserDefinedImport

OnBeforeImport event

TQImportRow object