Solved

comparing records in a database

Posted on 1998-10-01
1
234 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

756 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