BCS Data Grid With Data Entry Component Enhancement


Many times it is advantageous to use a component to accomplish data entry as opposed to the default data entry platform. An example of this it to use a component for date time data entry. A drop down calendar and spin controls for the other data entry functions is readily available.
The code snippet below shows how to implement component functionality for data entry capabilities.
[codesyntax lang=”delphi”]

{*-----------------------------------------------------------------------------
 Procedure: BCSTasksGrid1TitleClick
 Date:      14-Aug-2013
 @Param     Column: TColumn
 @Return    None
 -----------------------------------------------------------------------------}
procedure TBCSTasksC.BCSTasksGrid1CellClick(Column: TColumn);
begin
  if ((Column.Field.FullName = 'sdt') or (Column.Field.FullName = 'edt')) then
  begin
    BCSGetDateTimeCmp1.SelDateTime := Column.Field.AsDateTime;
    if BCSGetDateTimeCmp1.Execute then
    begin
      BCSTasksGrid1.DataSource.DataSet.Edit;
      Column.Field.AsDateTime := BCSGetDateTimeCmp1.SelDateTime;
      BCSTasksGrid1.DataSource.DataSet.Post;
    end;
  end;
end;

[/codesyntax]
In our example two date fields are employed.  Any number of date fields may be used.  Simply modify the if statement to add as many date fields that are required.
Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

Leave a Reply

Your email address will not be published. Required fields are marked *