Solved

comparing records in a database

Posted on 1998-10-01
1
231 Views
Last Modified: 2010-04-06
Before i start thanks to the person who kindly assisted me with my last question.

I am trying to write a procedure that uses findkey to locate a record that part is ok, i then need to however compare the fields with the last record i went to and if there is a difference perform another procedure.

I am able to use findkey and assign the fields i need to compare to variables.  However i need to be able to compare these variables to the last record i did findkey on.

procedure Tproductionfrm.M1Pending; {checks for pending jobs in schedule}
var
  IsColorChange: Boolean;
  IsEndOfRun: Boolean;
  ColorToTest: String;
  ProductToTest: String;
begin
  IsColorChange:= False;
  IsEndOfRun:= False;
  with scheduler.SchT do
     begin
        Open;
        Edit;
        First;
           if FindKey(['Machine 1', 'P']) then {Pending}
           begin
              ProductToTest:=scheduler.SchT.Fields[3].AsString; {product for selected record}
              ColorToTest:=scheduler.SchT.Fields[4].AsString; {colour for selected record}
           end;

     end;
end;

This is the basics at the moment and i have yet to perform any comparison.

any clues?
0
Comment
Question by:npepper
1 Comment
 

Accepted Solution

by:
chrismo earned 100 total points
ID: 1341419
I would say set up two additional variables that store the previous value:

var
  LastProductToTest: string;
  LastColorToTest: string;
begin
  ProductToTest := ...
  ColorToTest := ...

  if (ProductToTest <> LastProductToTest)
     or
     (ColorToTest <> LastColorToTest) then
    DoOtherMethod;

  LastProductToTest := ProductToTest;
  LastColorToTest := ColorToTest;
end;

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Send message from delphi to whatsapp, is it possible? 3 1,160
Reconfigure Delphi Install? 2 46
How to debug For loops? 3 45
Delphi: Connect to running MS Outlook 4 48
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now