Home > Back-end >  Delphi circulation problems
Delphi circulation problems

Time:09-29

The existing two fields client character, htflag Boolean
If the client has the same record htflag off automatically

CodePudding user response:

Thinking about this: first cycle to find the client value to the same record (can be placed in the array, can also on TStringList inside), and then walk cycle of htflag tick,

CodePudding user response:

Have duplicate records data screening out first, and then have to do is to collect data at a time, or to judge every time

CodePudding user response:

For I:=0 to lstClient. Do the count - 1
The begin
If not lsthtflag [I] then
Beging
For j:=I to lstClient. Do the Count - 1
The begin
If lstClient [I]=lstClient [j] then
The begin
Lsthtflag: [I]=true;
Lsthtflag [j] :=true;
break;
end;
end;
end;
end;

CodePudding user response:

1, will need to deal with the data read in DBGrid1;
2, execute the following code:
 procedure TMedicineInOutFrm. Button45Click (Sender: TObject); 
Var S: a string;
A: an array of array [0.. 1] of the String;
Top, I, J: integer;
T: Boolean;
The begin
With DBGrid1. The DataSource. The DataSet do
The begin
First;
Top:=0;
While Not Eof do
The begin
S:=FieldByName (" client "). The asString;
If S<> "' then
The begin
SetLength (A, Top + 1);
A [Top, 0] :=S;
Top:=Top + 1;
end;
Next;
end;
end;
For I:=0 to do Top - 1
Do for j:=0 to Top - 1
If I<> J then
If A [I, 0]=[j, 0] A then A [I, 1) :='1';
With DBGrid1. The DataSource. The DataSet do
The begin
First;
While Not Eof do
The begin
T:=False;
S:=FieldByName (" client "). The asString;
For I:=0 to do Top - 1
If A/I, 0=S then
If A (I, 1)='1' then T:=True;
Edit;
FieldByName (' htflag). AsBoolean:=T;
Post;
Next;
end;
end;
end;

CodePudding user response:


The LS code, unknown sleep and complete
  • Related