BCS Delphi XE8 Clone A Record Code Generator


This code snippet will generate the source code needed to clone a new record in a data table from an existing record.
dbs

procedure TBCSResumedm.car(ta: TUniTable);
var
  i: Integer;
  buf: String;
  sc: TStringList;
begin
  sc := TStringList.Create;
  sc.Add('  InsertRecord ' + ta.Name +'([');
  i := 0;
  repeat
    buf := '    ' + ta.Name + '.FieldByName(' + '''' + ta.Fields[i].FullName +
      '''' + ').AsString,';
    if i = ta.Fields.Count - 1 then
    begin
      Delete(buf, Length(buf), 1);
      buf := buf +']);';
    end;
    sc.Add(buf);
    Inc(i);
  until i > ta.Fields.Count - 1;
  sc.SaveToFile('xxx.txt');
  sc.Free;
end;

The resulting code is shown below.  Simply create a new procedure in you data module and paste this source code in there and you are ready to clone data records.
InsertRecord atamea([
    nil,
    atamea.FieldByName('fname').AsString,
    atamea.FieldByName('mname').AsString,
    atamea.FieldByName('lname').AsString,
    atamea.FieldByName('addr').AsString,
    atamea.FieldByName('phone').AsString,
    atamea.FieldByName('apemail').AsString,
    atamea.FieldByName('appdate').AsString,
    atamea.FieldByName('ov18').AsString,
    atamea.FieldByName('wus').AsString,
    atamea.FieldByName('felony').AsString,
    atamea.FieldByName('felexp').AsString,
    atamea.FieldByName('posap').AsString,
    atamea.FieldByName('startdate').AsString,
    atamea.FieldByName('skillslictng').AsString,
    atamea.FieldByName('conpres').AsString,
    atamea.FieldByName('pwd').AsString,
    atamea.FieldByName('fmtname').AsString,
    atamea.FieldByName('cat').AsString,
    atamea.FieldByName('obj').AsString]);

Position the table to the record you would like to clone and call the newly created procedure and you record wil be cloned.

Notice the autoinc field is replaced with nil.  This is done so not to interfere with the table’s normal processing.

{*-----------------------------------------------------------------------------
  Procedure: Clone
  Author:    Mr. Arch Brooks, Software Engineer, Brooks Computing Systems LLC
  Date:      20-Aug-2015
  @Param     None
  @Return    None
-----------------------------------------------------------------------------}
 
procedure TBCSResumedm.Clone;
begin
    atamea.InsertRecord ([
    nil,
    atamea.FieldByName('fname').AsString,
    atamea.FieldByName('mname').AsString,
    atamea.FieldByName('lname').AsString,
    atamea.FieldByName('addr').AsString,
    atamea.FieldByName('phone').AsString,
    atamea.FieldByName('apemail').AsString,
    atamea.FieldByName('appdate').AsString,
    atamea.FieldByName('ov18').AsString,
    atamea.FieldByName('wus').AsString,
    atamea.FieldByName('felony').AsString,
    atamea.FieldByName('felexp').AsString,
    atamea.FieldByName('posap').AsString,
    atamea.FieldByName('startdate').AsString,
    atamea.FieldByName('skillslictng').AsString,
    atamea.FieldByName('conpres').AsString,
    atamea.FieldByName('pwd').AsString,
    atamea.FieldByName('fmtname').AsString,
    atamea.FieldByName('cat').AsString,
    atamea.FieldByName('obj').AsString]);
end;

Repeat this process for each table you desire records to be cloned from and you are all set.

This code can also be modified to generate the complete series of SQL statements for subsequent use.

The source code may be found by clicking here.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS Delphi XE8 Database Navigation


There are those time when you will need to traverse databases to attain the desired information.
dbs
The BCS Delphi XE8 Database Navigation tool will allow you to traverse to your hearts content.

{*-----------------------------------------------------------------------------
 Procedure: DBPos
 Author: Mr. Arch Brooks, Software Engineer, Brooks Computing Systems LLC
 Date: 19-Aug-2015
 @Param dbn: TDBNavigator; sfn: String
 @Return None
-----------------------------------------------------------------------------}
 
Procedure TBCSPwbC.DBPos(dbn: TDBNavigator; sfn: String);
var
  pb: String;
  cp: String;
begin
  pb := InputBox('Enter Starting Position!', 'Where Do I Start!', '');
  if Trim(pb) = '' then
  begin
    MessageBox(Handle, 'You want to search with a nill string!',
      'No Search Available!', mb_OkCancel);
    exit;
  end;
  cp := dbn.DataSource.Dataset.FieldByName(sfn).AsString;
  if pb < cp then
  begin
    repeat
      dbn.DataSource.Dataset.Prior;
    until ((pb >= dbn.DataSource.Dataset.FieldByName(sfn).AsString) or
      (dbn.DataSource.Dataset.RecNo = 1));
  end
  else
  begin
    repeat
      dbn.DataSource.Dataset.Next;
    until ((dbn.DataSource.Dataset.FieldByName(sfn).AsString >= pb) or
      (dbn.DataSource.Dataset.Eof));
  end;
  cp := cp;
end;

When I observed the scenario I determined the common denominator was the database navigator and a key string field.

In addition to traversing forward the capability to traverse in a backwards direction was also desirable.  Upon initial testing a loop occurred so I determined the logic of the routine would have to detect the start and end of the data set.  The logic was also put into place that determined direction of the search depending on the search key criteria.

If the key was less than the current database position the search would be in a backwards direction.  Conversely if the key was greater then the database position the search would in a forward direction. This handy utility works for any data table connected to database navigator TDBNavigator.

The source code may be found by clicking here.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored
this article.

BCS c++ Builder XE8 Source Code Generator


The new BCS c++ Builder Source Code Generator is available to the public.
cppcg
Fill in the Family ID and click the OK button.  You will then be prompted for the target location of the source code. Select the generation option (No Data, Single Table or Master Detail) and the associated code is generated.  When the dialog closes you will have a complete c++ project at the location you selected.

Precautions are take so there is no way possible to write over existing projects.

Of course all the available themes and styles are available and ready for use.

cppcgst
To use the data support features select option “Single Table” or “Master Detail” and the first screen to appear is depicted below.
uail2
The screen above lists all unique alias entries.  This approach speeds up the location of the desired alias.

The next screen appears and you are positioned to the first item for the selected alias.
uail2
Simply double click on the desired ails and the source code generation process continues.

By using one dialog and two screens the end user can generate source code that supports no data, a single data table or a master detail table scenario.

When the master detail scenario is selected the process is the same but then the master detail data selection dialog appears as depicted below.
uail3

When you click on the table for the master or detail table the data elements populate the lower list boxes.  You must then select the master key element on the left and the detail key element on the right.
uail4
The application prompts you when information is not complete until the information is supplied that will successfully generate the master detail scenario.

The source code may be found by clicking here.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS Delphi XE8 Task Application Styles


This application allows the user to track and report tasks.  Elapsed times between the start and finished time are calculated automatically.
tlns
To handle date and time data entry the BCS Get Date Time component is used.  This component must be installed to use this utility. Click here to view the component documentation.

A 32 bit executable program may be downloaded by clicking here.
A 64 bit executable program may be downloaded by clicking here.
The component documentation can be found by clicking here.
The source code may be found by clicking here.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS Delphi XE8 Program Tracker

During periods of high activity the technician can become overwhelmed with the pace and sheer volume of  programming and task requests.  The BCS Delphi XE8 Program Tracker offers relief for this level of tedium.
ptra01

A MySQL database with the name of “dpt” minus quotes must exist.  Simply import the “dpt.sql” into your installations MySQL platform.

There is a documentation work pad available when you click on the Detailed Description tab as depicted below.
ptra02
Whenever a project is selected click on the List Project File menu item and a list of project files will appear under the project workbench tab.  This tab is dynamically generated.
ptra03
when you double click on any file name in the list the contents of that file is listed in the Code Viewer tab as depicted below.
ptra04
Return to the Files In Project tab by clicking on that tab to return to the list of files.  Double click on the next file to view.

When you return to the Project Description tab and double click on the grid either the Delphi XE8 or the c++ Builder development environment is activated and you can continue development of the application.
ptra05
When the Reports menu item is clicked the Project Details menu item appears and when it is clicked the following report appears.
ptra06
As you can see this is a handy development tool for reviewing and developing Rad application.

The component documentation can be found by clicking here.
The source code may be found by clicking here.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

BCS Delphi Cookbook Examples Repository


This application allows the programer to stay organized when working with the examples for the Delphi Cookbook.
dcb
The first task is to identify where the project code resides.
dcbproj

When the user double clicks on the project the compiler is invoked. From there the technician can create the associated executable.

When the user clicks on any other field the program is executed.

This application uses MySQL for the back end so create a MySQL database and call it “delr” (minus quotes).  Our acronym identifies the Delphi Repository.

The first table “ch” is populated and identifies all the chapters.  The second table “rec” is also populated that identifies all the recipes.   The third table (not populated) contains the actual details of the recipes.

When the user inserts a new entry for the project by clicking the “+” in the Project Navigator the following dialog appears.
dcbsf
Simply traverse to the location where the recipes reside and select the associated .dproj file.  the application creates and populates the executable file specifications.

When you click on the desired chapter the application dynamically places you in the details of the lesson.  When you click on a lesson the application dynamically places you in the lesson’s project(s).

A 32 bit executable program may be downloaded by clicking here.
The component documentation can be found by clicking here.
The source code may be found by clicking here.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

 

BCS Delphi XE8 Task List Manager

There are those time when the programmer needs to manage task in standard operation.
bcstman

The BCS Select Date And Time Component is required for this software.  Review the specification by clicking here.

The component documentation can be found by clicking here.
The source code may be found by clicking here.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.