Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8864855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:21:30+00:00 2026-06-14T16:21:30+00:00

I have the following code, all the code needs to do is go through

  • 0

I have the following code, all the code needs to do is go through a list of vehicles and remove the spaces in each registration but before changing it, it should check to make sure the ammended registration doesn’t exist. The following code is what I am using:

unit Main;
interface

uses
 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
 Dialogs, Menus, cxLookAndFeelPainters, StdCtrls, cxButtons, Gauges, DB,
 DBTables, StrUtils;

type
TfrmMain = class(TForm)
  prgTotal: TGauge;
  btnStart: TcxButton;
  tblVeh: TTable;
  tblVehRegNo: TStringField;
  procedure btnStartClick(Sender: TObject);
private
  procedure OpenTable(pTable: TTable);
  procedure CloseTable(pTable: TTable; pPost: Boolean);
  { Private declarations }
public
  { Public declarations }
end;

var
  frmMain   : TfrmMain;
  lvRegLst  : TStringList;
  lvTblSize : Integer;
  lvOrigReg : String;
  lvNewReg  : String;
  lvTest    : integer;

implementation

{$R *.dfm}

procedure TfrmMain.btnStartClick(Sender: TObject);
begin
  btnStart.Enabled := False;
  lvRegLst  := TStringList.Create;

  // Open Tables
  tblVeh.Open;
  tblVeh.First;

  // Set progress
  prgTotal.MinValue := 0;
  lvTblSize         := tblVeh.RecordCount;
  prgTotal.MaxValue := tblVeh.RecordCount;
  btnStart.Caption  := 'Parsing Registration Numbers...';

  // Conversion
  while not tblVeh.Eof do
  begin
    lvRegLst.Add(tblVehRegNo.AsString);
    tblVeh.Next;
    prgTotal.AddProgress(1);
    Application.ProcessMessages;
  end;

  tblVeh.First;
  lvTest            := lvRegLst.Count;
  prgTotal.Progress := 0;
  btnStart.Caption  := 'Removing Spaces...';

  while not tblVeh.Eof do
  begin
    lvOrigReg := tblVehRegNo.AsString;
    lvNewReg  := AnsiReplaceStr(lvOrigReg,' ','');

    if lvRegLst.IndexOf(lvNewReg) = -1 then
    begin
      tblVeh.Edit;
      tblVehRegNo.AsString := lvNewReg;
      prgTotal.AddProgress(1);
      tblVeh.Post;
    end;

    tblVeh.Next;
    prgtotal.AddProgress(1);
    Application.ProcessMessages;
  end;

  // Close Tables
  tblVeh.Edit;
  tblVeh.Post;
  tblVeh.Close;

  btnStart.Caption := '&Start Conversion';
  btnStart.Enabled := True;
end;

I have stepped through the code and all looks fine and it successfuly changes the registration against the vehicle but when looking at the table afterwards it’s not made any changes.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T16:21:32+00:00Added an answer on June 14, 2026 at 4:21 pm

    The issue was with the database itself, it turns out ‘RegNo’ is the only key field so it’s the default index. As my conversion was running through it was changing registrations which moved the ‘cursor’ and skipped over a number of registrations.

    I have added another index for the purpose of this conversion but making around 50-60 passes over their data would have eventually sorted out all of the registrations.

    Thank you for all of the help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: Tag.find_all_by_company_id(4).each.collect{|tag| tag.name }.join(,) (Essentially I'm trying to build a
Suppose I have the following code to collect all the possible combinations. abArray =
So I have the following code for fetching all of my core data entities
I have the following code to assign a value to all the elements of
I have this following code which will return all the current semesters. How do
i have the following code def get(self): date = datetime.date.today() loc_query = Location.all() last_cursor
The following asynchronous C# code runs through a list of 7 URLs and tries
I have the following code snippet from my PowerShell script that... Loops through a
I have following code: IEnumerable<token> token; token = abc.GetToken(bcd); // this gets a list
I have the following code: function build_all_combinations(input_array){ array = [1,2,3] limit = array.length -

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.