Einzelnen Beitrag anzeigen

Ykcim

Registriert seit: 29. Dez 2006
Ort: NRW
831 Beiträge
 
Delphi 10.4 Sydney
 
#7

AW: Arbeitsspeicher läuft über - wie leeren

  Alt 19. Aug 2010, 09:18
Hallo Zusammen,

ich habe jetzt einfach mal die Prcedure gepostet. Ich hoffe, dass hilft weiter...

Delphi-Quellcode:
procedure TFrame1.SuchenClick(Sender: TObject);
var query1, query2, query3, query4, query5, query6, query7, query8, query9: string;
    Cols1, Cols2, Cols3, Cols4, Cols5, Cols6, Cols7, Cols8, Cols9, Cols41, ColsKZ, ColsFinal, ColsSearch: TCols;
    Rows1, Rows2, Rows3, Rows4, Rows5, Rows6, Rows7, Rows8, Rows9, Rows41, RowsKZ, RowsFinal, RowsSearch: TRows;
    i, j, k, l: integer;
    Startzeit1, Startzeit2, Startzeit3, Endzeit1, Endzeit2, Endzeit3: cardinal;
begin

  Startzeit1:=gettickcount;
  Startzeit2:=gettickcount;
  query1:='select MA_VA_ID, arbeitsplatzKZ from Zustaendigkeiten ' +
          'where MA_VA_ID='+inttostr(MainUnit.UserID)+' or MA_VE_ID='+inttostr(MainUnit.UserID);
  MainUnit.connect;
  MainUnit.ExecQuery(DB, query1, Cols1, Rows1);
  MainUnit.disconnect;
   query2:='select MA_VA_ID, AS400KZ from Lohnlieferanten ' +
           'where MA_VA_ID='+inttostr(MainUnit.UserID)+' or MA_VE_ID='+inttostr(MainUnit.UserID);
  MainUnit.connect;
  MainUnit.ExecQuery(DB, query2, Cols2, Rows2);
  MainUnit.disconnect;
  query3:='select UserID from Benutzer where Status='+#39+'inaktiv'+#39;
  MainUnit.connect;
  MainUnit.ExecQuery(DB, query3, Cols3, Rows3);
  MainUnit.disconnect;
  query5:='select UserID, concat(Vorname,'+#39+' '+#39+', name), AS400KZ from Benutzer';
  MainUnit.connect;
  MainUnit.ExecQuery(DB, query5, Cols5, Rows5);
  MainUnit.disconnect;
  query6:='SELECT Datum, Verfasser, WAAUNR, WAAUPO, Kommentar FROM kommentfa A '+
          'where (Datum = ( SELECT MAX(Datum) FROM kommentFA B '+
          'WHERE (A.WAAUNR = B.WAAUNr) and (A.WAAUPO=B.WAAUPO))) '+
          'and (ConCat(WAAUNR,'+#39+'-'+#39+',WAAUPO) in '+
          '(select ConCat(WAAUNR,'+#39+'-'+#39+',WAAUPO) from eilfa group by ConCat(WAAUNR,'+#39+'-'+#39+',WAAUPO)))';
  MainUnit.Connect;
  MainUnit.ExecQuery(DB, query6, Cols6, Rows6);
  MainUnit.disconnect;
  query7:='select as400.WAAUNR,' +
         ' as400.WAAUPO,' +
         ' as400.OAAGNR,' +
         ' DATE_FORMAT(as400.OARMDA,'+#39+'%d.%m.%Y'+#39+') as OAMRDA '+
         'from as400 where WASTAT<>50 ';
  MainUnit.connect;
  MainUnit.ExecQuery(DB,query7,Cols7,Rows7);
  MainUnit.disconnect;
  EndZeit2:=gettickcount;
  Startzeit3:=gettickcount;
  if Kriterium.Text<>'then
    begin
      if Length(Kriterium.Text)=6 then
        begin
          query4:= 'select WAAUNR,' +
                   ' WAAUPO,' +
                   ' WATENR,' +
                   ' TEBEZ1,' +
                   ' REPLACE(FORMAT(WAFEMG, 0),'+#39+ ','+#39+', '+#39+'.'+#39+'),' +
                   ' OAAGNR,' +
                   ' OAAGBZ,' +
                   ' OAMANR,' +
                   ' OATLKZ,' +
                   ' DATE_FORMAT(LGZGDA,'+#39+'%d.%m.%Y'+#39+') as LGZGDA, ' +
                   ' KRITFA ' +
                   'from as400 ' +
                   'where OATLKZ<>9 and WASTAT<>50 and WAAUNR=' +Kriterium.Text+' '+
                   'GROUP BY WATENR, WAAUNR '+
                   'ORDER BY OAAGNR DESC, WAAUNR ';
        end
      else if Length(Kriterium.Text)=8 then
        begin
          query4:= 'select WAAUNR,' +
                   ' WAAUPO,' +
                   ' WATENR,' +
                   ' TEBEZ1,' +
                   ' REPLACE(FORMAT(WAFEMG, 0),'+#39+ ','+#39+', '+#39+'.'+#39+'),' +
                   ' OAAGNR,' +
                   ' OAAGBZ,' +
                   ' OAMANR,' +
                   ' OATLKZ,' +
                   ' DATE_FORMAT(LGZGDA,'+#39+'%d.%m.%Y'+#39+') as LGZGDA, ' +
                   ' KRITFA ' +
                   'from as400 ' +
                   'where OATLKZ<>9 and WASTAT<>50 and WATENR=' +Kriterium.Text+' '+
                   'GROUP BY WATENR, WAAUNR '+
                   'ORDER BY OAAGNR DESC, WAAUNR ';
        end;
    end
  else
    begin
      query4:='select WAAUNR,' +
             ' WAAUPO,' +
             ' WATENR,' +
             ' TEBEZ1,' +
             ' REPLACE(FORMAT(WAFEMG, 0),'+#39+ ','+#39+', '+#39+'.'+#39+'),' +
             ' OAAGNR,' +
             ' OAAGBZ,' +
             ' OAMANR,' +
             ' OATLKZ,' +
             ' DATE_FORMAT(LGZGDA,'+#39+'%d.%m.%Y'+#39+') as LGZGDA, ' +
             ' KRITFA ' +
             'from as400 ' +
             'where OATLKZ<>9 and WASTAT<>50 ' +
             'GROUP BY WATENR, WAAUNR '+
             'ORDER BY OAAGNR DESC, WAAUNR ';
    end;
  MainUnit.connect;
  MainUnit.ExecQuery(DB,query4,Cols41,Rows41);
  MainUnit.disconnect;

  if Statusoffen.Checked=true then
    begin
      query8:='select WAAUNR, ' +
              ' WAAUPO, ' +
              ' OAAGNR, ' +
              ' DATE_FORMAT(Start,'+#39+'%d.%m.%Y'+#39+') as Start, '+
              ' UserID, '+
              ' angeschoben, ' +
              ' Printed ' +
              ' from eilfa '+
              ' where start='+#39+'0000-00-00'+#39;
    end
  else if Statusbearbeitet.Checked=true then
    begin
      query8:='select WAAUNR, ' +
              ' WAAUPO, ' +
              ' OAAGNR, ' +
              ' DATE_FORMAT(Start,'+#39+'%d.%m.%Y'+#39+') as Start, '+
              ' UserID, '+
              ' angeschoben, ' +
              ' Printed ' +
              ' from eilfa '+
              ' where start<>'+#39+'0000-00-00'+#39
    end
  else
    begin
      query8:='select WAAUNR, ' +
              ' WAAUPO, ' +
              ' OAAGNR, ' +
              ' DATE_FORMAT(Start,'+#39+'%d.%m.%Y'+#39+') as Start, '+
              ' UserID, '+
              ' angeschoben, ' +
              ' Printed ' +
              ' from eilfa';
    end;
  MainUnit.connect;
  MainUnit.ExecQuery(DB,query8,Cols8,Rows8);
  MainUnit.disconnect;
  if eigeneEilFA.Checked=true then
    begin
      setlength(Cols4,15);
      Cols4:=Cols41;
      setlength(Cols4,15);
      k:=0;
      for i := 0 to Length(Rows41[0]) - 1 do
        begin
          for j := 0 to Length(Rows8[0]) - 1 do
            begin
              if (Rows41[0,i]=Rows8[0,j]) and
                 (Rows41[1,i]=Rows8[1,j]) and
                 (Rows41[5,i]=Rows8[2,j]) then
                begin
                  k:=k+1;
                  setlength(Rows4,Length(Cols4),k);
                  Rows4[0,k-1]:=Rows41[0,i];
                  Rows4[1,k-1]:=Rows41[1,i];
                  Rows4[2,k-1]:=Rows41[2,i];
                  Rows4[3,k-1]:=Rows41[3,i];
                  Rows4[4,k-1]:=Rows41[4,i];
                  Rows4[5,k-1]:=Rows41[5,i];
                  Rows4[6,k-1]:=Rows41[6,i];
                  Rows4[7,k-1]:=Rows41[7,i];
                  Rows4[8,k-1]:=Rows41[8,i];
                  Rows4[9,k-1]:=Rows41[9,i];
                  Rows4[10,k-1]:=Rows41[10,i];
                  Rows4[11,k-1]:=Rows8[3,j];
                  Rows4[12,k-1]:=Rows8[4,j];
                  Rows4[13,k-1]:=Rows8[5,j];
                  Rows4[14,k-1]:=Rows8[6,j];
                end;
            end;
        end;
      Endzeit3:=gettickcount;
  {----------------------------------------------------------------------------}
  //Selektierung der relevanten KZs (Zuständigkeiten)
      k:=0;
      setlength(ColsKZ,1);
      setlength(RowsKZ,Length(ColsKZ),k);
      ColsKZ[0]:='AS400KZ';
      for i := 0 to Length(Rows1[0]) - 1 do
        begin
          if Rows1[0,i]<>inttostr(MainUnit.UserID) then
            begin
              for j := 0 to Length(Rows3[0]) - 1 do
                begin
                  if Rows1[0,i]=Rows3[0,j] then
                    begin
                      k:=k+1;
                      setlength(RowsKZ,1,k);
                      RowsKZ[0,k-1]:=Rows1[1,i];
                    end;
                end;
            end
          else
            begin
              k:=k+1;
              setlength(RowsKZ,1,k);
              RowsKZ[0,k-1]:=Rows1[1,i];
            end;
        end;
  {----------------------------------------------------------------------------}
  //Selektierung der relevanten KZs (Lohnlieferanten)
      for i := 0 to Length(Rows2[0]) - 1 do
        begin
          if Rows2[0,i]<>inttostr(MainUnit.UserID) then
            begin
              for j := 0 to Length(Rows3[0]) - 1 do
                begin
                  if Rows2[0,i]=Rows3[0,j] then
                    begin
                      k:=k+1;
                      setlength(RowsKZ,1,k);
                      RowsKZ[0,k-1]:=Rows2[1,i];
                    end;
                end;
            end
          else
            begin
              k:=k+1;
              setlength(RowsKZ,1,k);
              RowsKZ[0,k-1]:=Rows2[1,i];
            end;
        end;
  {----------------------------------------------------------------------------}
  //Selektierung der relevanten Aufträge
      k:=0;
      setlength(ColsFinal,Length(Cols4)+2);
      setlength(RowsFinal,Length(ColsFinal),k);
      for i := 0 to Length(Cols4) - 1 do
        begin
          ColsFinal[i]:=Cols4[i];
        end;

      for i := 0 to Length(Rows4[0]) - 1 do
        begin
          for j := 0 to Length(RowsKZ[0]) - 1 do
            begin
              if copy(Rows4[7,i],0,2)=RowsKZ[0,j] then
                begin
                  k:=k+1;
                  setlength(RowsFinal,Length(ColsFinal),k);
                  for l := 0 to Length(Cols4) - 1 do
                    begin
                      RowsFinal[l,k-1]:=Rows4[l,i];
                    end;
                  for l := Length(ColsFinal) - 1 downto 9 do
                    begin
                      RowsFinal[l,k-1]:=RowsFinal[l-1,k-1];
                    end;
                end;
            end;
        end;
      ColsFinal[0]:=' FANr'; ColsFinal[8]:=' F';
      ColsFinal[1]:=' Zus'; ColsFinal[10]:=' LaZugang';
      ColsFinal[2]:=' ArtikelNr'; ColsFinal[11]:=' AT';
      ColsFinal[3]:=' Artikel-Bez'; ColsFinal[12]:=' SOLL-Fertig';
      ColsFinal[4]:=' Menge'; ColsFinal[13]:=' Kommmentar';
      ColsFinal[5]:=' AG'; ColsFinal[14]:=' MA';
      ColsFinal[6]:=' AG-Bez'; ColsFinal[9]:=' WA-Datum';
      ColsFinal[7]:=' Masch.'; ColsFinal[15]:=' Printed';
  {----------------------------------------------------------------------------}
  //Kommentare und User dazu
      for i := 0 to Length(RowsFinal[0]) - 1 do
        begin
          RowsFinal[16,i]:=RowsFinal[14,i];
          for l := 0 to Length(rows5[0]) - 1 do
            begin
              if RowsFinal[13,i]=Rows5[0,l] then
                begin
                  RowsFinal[14,i]:=Rows5[2,l];
                  RowsFinal[13,i]:='';
                end;
            end;
          for j := 0 to Length(Rows6[0]) - 1 do
            begin
              if (RowsFinal[0,i]=Rows6[2,j]) and (RowsFinal[1,i]=Rows6[3,j]) then
                begin
                  for k := 0 to Length(Rows5[0]) - 1 do
                    begin
                      if Rows5[1,k]=Rows6[1,j] then
                        begin
                          RowsFinal[13,i]:=Rows5[2,k]+':'+Rows6[4,j];
                        end;
                    end;
                end;
            end;
        end;
  {----------------------------------------------------------------------------}
  //WA-Datum dazu
      for i := 0 to Length(RowsFinal[0]) - 1 do
        begin
          for j := 0 to Length(Rows7[0]) - 1 do
            begin
              if (RowsFinal[0,i]=Rows7[0,j]) and (RowsFinal[1,i]=Rows7[1,j])
              and (RowsFinal[5,i]=Rows7[2,j]) then
                begin
                  if Rows7[0,j-1]=Rows7[0,j] then
                    begin
                      RowsFinal[9,i]:=Rows7[3,j-1];
                    end;
                end;
            end;
        end;
    end
  else if AlleEilFa.Checked=true then
    begin
      setlength(Cols4,15);
      Cols4:=Cols41;
      setlength(Cols4,15);
      k:=0;
      for i := 0 to Length(Rows41[0]) - 1 do
        begin
          for j := 0 to Length(Rows8[0]) - 1 do
            begin
              if (Rows41[0,i]=Rows8[0,j]) and
                 (Rows41[1,i]=Rows8[1,j]) and
                 (Rows41[5,i]=Rows8[2,j]) then
                begin
                  k:=k+1;
                  setlength(Rows4,Length(Cols4),k);
                  Rows4[0,k-1]:=Rows41[0,i];
                  Rows4[1,k-1]:=Rows41[1,i];
                  Rows4[2,k-1]:=Rows41[2,i];
                  Rows4[3,k-1]:=Rows41[3,i];
                  Rows4[4,k-1]:=Rows41[4,i];
                  Rows4[5,k-1]:=Rows41[5,i];
                  Rows4[6,k-1]:=Rows41[6,i];
                  Rows4[7,k-1]:=Rows41[7,i];
                  Rows4[8,k-1]:=Rows41[8,i];
                  Rows4[9,k-1]:=Rows41[9,i];
                  Rows4[10,k-1]:=Rows41[10,i];
                  Rows4[11,k-1]:=Rows8[3,j];
                  Rows4[12,k-1]:=Rows8[4,j];
                  Rows4[13,k-1]:=Rows8[5,j];
                  Rows4[14,k-1]:=Rows8[6,j];
                end;
            end;
        end;
      Endzeit3:=gettickcount;
  {----------------------------------------------------------------------------}
  //Selektierung der relevanten Aufträge
      k:=0;
      setlength(ColsFinal,Length(Cols4)+2);
      setlength(RowsFinal,Length(ColsFinal),k);
      for i := 0 to Length(Cols4) - 1 do
        begin
          ColsFinal[i]:=Cols4[i];
        end;

      for i := 0 to Length(Rows4[0]) - 1 do
        begin
          k:=k+1;
          setlength(RowsFinal,Length(ColsFinal),k);
          for l := 0 to Length(Cols4) - 1 do
            begin
              RowsFinal[l,k-1]:=Rows4[l,i];
            end;
            for l := Length(ColsFinal) - 1 downto 9 do
              begin
                RowsFinal[l,k-1]:=RowsFinal[l-1,k-1];
              end;
        end;
      ColsFinal[0]:=' FANr'; ColsFinal[8]:=' F';
      ColsFinal[1]:=' Zus'; ColsFinal[10]:=' LaZugang';
      ColsFinal[2]:=' ArtikelNr'; ColsFinal[11]:=' AT';
      ColsFinal[3]:=' Artikel-Bez'; ColsFinal[12]:=' SOLL-Fertig';
      ColsFinal[4]:=' Menge'; ColsFinal[13]:=' Kommmentar';
      ColsFinal[5]:=' AG'; ColsFinal[14]:=' MA';
      ColsFinal[6]:=' AG-Bez'; ColsFinal[9]:=' WA-Datum';
      ColsFinal[7]:=' Masch.'; ColsFinal[15]:=' Printed';
  {----------------------------------------------------------------------------}
  //Kommentare und User dazu
      for i := 0 to Length(RowsFinal[0]) - 1 do
        begin
          RowsFinal[16,i]:=RowsFinal[14,i];
          for l := 0 to Length(rows5[0]) - 1 do
            begin
              if RowsFinal[13,i]=Rows5[0,l] then
                begin
                  RowsFinal[14,i]:=Rows5[2,l];
                  RowsFinal[13,i]:='';
                end;
            end;
          for j := 0 to Length(Rows6[0]) - 1 do
            begin
              if (RowsFinal[0,i]=Rows6[2,j]) and (RowsFinal[1,i]=Rows6[3,j]) then
                begin
                  for k := 0 to Length(Rows5[0]) - 1 do
                    begin
                      if Rows5[1,k]=Rows6[1,j] then
                        begin
                          RowsFinal[13,i]:=Rows5[2,k]+':'+Rows6[4,j];
                        end;
                    end;
                end;
            end;
        end;
  {----------------------------------------------------------------------------}
  //WA-Datum dazu
      for i := 0 to Length(RowsFinal[0]) - 1 do
        begin
          for j := 0 to Length(Rows7[0]) - 1 do
            begin
              if (RowsFinal[0,i]=Rows7[0,j]) and (RowsFinal[1,i]=Rows7[1,j])
              and (RowsFinal[5,i]=Rows7[2,j]) then
                begin
                  if Rows7[0,j-1]=Rows7[0,j] then
                    begin
                      RowsFinal[9,i]:=Rows7[3,j-1];
                    end;
                end;
            end;
        end;
    end
  else
    begin
      setlength(Cols4,15);
      Cols4:=Cols41;
      setlength(Cols4,15);
      k:=0;
      for i := 0 to Length(Rows41[0]) - 1 do
        begin
          k:=k+1;
          setlength(Rows4,Length(Cols4),k);
          Rows4[0,k-1]:=Rows41[0,i];
          Rows4[1,k-1]:=Rows41[1,i];
          Rows4[2,k-1]:=Rows41[2,i];
          Rows4[3,k-1]:=Rows41[3,i];
          Rows4[4,k-1]:=Rows41[4,i];
          Rows4[5,k-1]:=Rows41[5,i];
          Rows4[6,k-1]:=Rows41[6,i];
          Rows4[7,k-1]:=Rows41[7,i];
          Rows4[8,k-1]:=Rows41[8,i];
          Rows4[9,k-1]:=Rows41[9,i];
          Rows4[10,k-1]:=Rows41[10,i];
          for j := 0 to Length(Rows8[0]) - 1 do
            begin
              if (Rows41[0,i]=Rows8[0,j]) and
                 (Rows41[1,i]=Rows8[1,j]) and
                 (Rows41[5,i]=Rows8[2,j]) then
                begin
                  Rows4[11,k-1]:=Rows8[3,j];
                  Rows4[12,k-1]:=Rows8[4,j];
                  Rows4[13,k-1]:=Rows8[5,j];
                  Rows4[14,k-1]:=Rows8[6,j];
                end;
            end;
        end;
      Endzeit3:=gettickcount;
  {----------------------------------------------------------------------------}
  //Selektierung der relevanten Aufträge
      k:=0;
      setlength(ColsFinal,Length(Cols4)+2);
      setlength(RowsFinal,Length(ColsFinal),k);
      for i := 0 to Length(Cols4) - 1 do
        begin
          ColsFinal[i]:=Cols4[i];
        end;

      for i := 0 to Length(Rows4[0]) - 1 do
        begin
          k:=k+1;
          setlength(RowsFinal,Length(ColsFinal),k);
          for l := 0 to Length(Cols4) - 1 do
            begin
              RowsFinal[l,k-1]:=Rows4[l,i];
            end;
            for l := Length(ColsFinal) - 1 downto 9 do
              begin
                RowsFinal[l,k-1]:=RowsFinal[l-1,k-1];
              end;
        end;
      ColsFinal[0]:=' FANr'; ColsFinal[8]:=' F';
      ColsFinal[1]:=' Zus'; ColsFinal[10]:=' LaZugang';
      ColsFinal[2]:=' ArtikelNr'; ColsFinal[11]:=' AT';
      ColsFinal[3]:=' Artikel-Bez'; ColsFinal[12]:=' SOLL-Fertig';
      ColsFinal[4]:=' Menge'; ColsFinal[13]:=' Kommmentar';
      ColsFinal[5]:=' AG'; ColsFinal[14]:=' MA';
      ColsFinal[6]:=' AG-Bez'; ColsFinal[9]:=' WA-Datum';
      ColsFinal[7]:=' Masch.'; ColsFinal[15]:=' Printed';
  {----------------------------------------------------------------------------}
  //Kommentare und User dazu
      for i := 0 to Length(RowsFinal[0]) - 1 do
        begin
          RowsFinal[16,i]:=RowsFinal[14,i];
          for l := 0 to Length(rows5[0]) - 1 do
            begin
              if RowsFinal[13,i]=Rows5[0,l] then
                begin
                  RowsFinal[14,i]:=Rows5[2,l];
                  RowsFinal[13,i]:='';
                end;
            end;
          for j := 0 to Length(Rows6[0]) - 1 do
            begin
              if (RowsFinal[0,i]=Rows6[2,j]) and (RowsFinal[1,i]=Rows6[3,j]) then
                begin
                  for k := 0 to Length(Rows5[0]) - 1 do
                    begin
                      if Rows5[1,k]=Rows6[1,j] then
                        begin
                          RowsFinal[13,i]:=Rows5[2,k]+':'+Rows6[4,j];
                        end;
                    end;
                end;
            end;
        end;
  {----------------------------------------------------------------------------}
  //WA-Datum dazu
      for i := 0 to Length(RowsFinal[0]) - 1 do
        begin
          for j := 0 to Length(Rows7[0]) - 1 do
            begin
              if (RowsFinal[0,i]=Rows7[0,j]) and (RowsFinal[1,i]=Rows7[1,j])
              and (RowsFinal[5,i]=Rows7[2,j]) then
                begin
                  if Rows7[0,j-1]=Rows7[0,j] then
                    begin
                      RowsFinal[9,i]:=Rows7[3,j-1];
                    end;
                end;
            end;
        end;
    end;
  if Arbeitsplatz.Text<>'then
    begin
      query9:='select Arbeitsgang, ArbeitsplatzKZ from zustaendigkeiten '+
              'where Arbeitsgang='+#39+Arbeitsplatz.Text+#39;
      MainUnit.connect;
      MainUnit.ExecQuery(DB, query9, Cols9, Rows9);
      MainUnit.disconnect;
    end
  else if Beschichter.Text<>'then
    begin
      query9:='select Firmenname, AS400KZ from lohnlieferanten '+
              'where Firmenname='+#39+Beschichter.Text+#39;
      MainUnit.connect;
      MainUnit.ExecQuery(DB, query9, Cols9, Rows9);
      MainUnit.disconnect;
    end;
  if (Arbeitsplatz.Text<>'') or (Beschichter.Text<>'') then
    begin
      k:=0;
      ColsSearch:=ColsFinal;
      for i := 0 to Length(RowsFinal[0]) - 1 do
        begin
          if copy(RowsFinal[7,i],0,2)=Rows9[1,0] then
            begin
              k:=k+1;
              setlength(RowsSearch,Length(ColsSearch),k);
              RowsSearch[0,k-1]:=RowsFinal[0,i];
              RowsSearch[1,k-1]:=RowsFinal[1,i];
              RowsSearch[2,k-1]:=RowsFinal[2,i];
              RowsSearch[3,k-1]:=RowsFinal[3,i];
              RowsSearch[4,k-1]:=RowsFinal[4,i];
              RowsSearch[5,k-1]:=RowsFinal[5,i];
              RowsSearch[6,k-1]:=RowsFinal[6,i];
              RowsSearch[7,k-1]:=RowsFinal[7,i];
              RowsSearch[8,k-1]:=RowsFinal[8,i];
              RowsSearch[9,k-1]:=RowsFinal[9,i];
              RowsSearch[10,k-1]:=RowsFinal[10,i];
              RowsSearch[11,k-1]:=RowsFinal[11,i];
              RowsSearch[12,k-1]:=RowsFinal[12,i];
              RowsSearch[13,k-1]:=RowsFinal[13,i];
              RowsSearch[14,k-1]:=RowsFinal[14,i];
              RowsSearch[15,k-1]:=RowsFinal[15,i];
              RowsSearch[16,k-1]:=RowsFinal[16,i];
            end;
        end;
      setlength(ColsFinal,17);
      RowsFinal:=RowsSearch;
      if Length(RowsFinal)=0 then
        setlength(RowsFinal, Length(ColsFinal),1);
    end;

{----------------------------------------------------------------------------}
  //StringGrid schreiben
  MainUnit.FillGrid(Suchergebnis, ColsFinal, RowsFinal);

  {----------------------------------------------------------------------------}
  //StringGrid Design
  if SUchergebnis.RowCount<2 then
    SUchergebnis.RowCount:=2;
  SUchergebnis.FixedRows:=1;

  SUchergebnis.ColWidths[0]:=40; SUchergebnis.ColWidths[8]:=15;
  SUchergebnis.ColWidths[1]:=30; SUchergebnis.ColWidths[10]:=60;
  SUchergebnis.ColWidths[2]:=55; SUchergebnis.ColWidths[11]:=20;
  SUchergebnis.ColWidths[3]:=80; SUchergebnis.ColWidths[12]:=60;
  SUchergebnis.ColWidths[4]:=55; SUchergebnis.ColWidths[13]:=220;
  SUchergebnis.ColWidths[5]:=30; SUchergebnis.ColWidths[14]:=40;
  SUchergebnis.ColWidths[6]:=100; SUchergebnis.ColWidths[9]:=60;
  SUchergebnis.ColWidths[7]:=40; SUchergebnis.ColWidths[15]:=50;
  SUchergebnis.ColWidths[16]:=0;

  Kriterium.SetFocus;
  Endzeit1:=gettickcount;
  //showmessage('Gesamtzeit: '+Format ('%d ms.',[endzeit1-startzeit1])+#10#13+'Ersten Querys: '+Format ('%d ms.',[endzeit2-startzeit2])+#10#13+'Query4: '+Format ('%d ms.',[endzeit3-startzeit3]));

 { ZeroMemory(@Rows1,SizeOf(Rows1));
  ZeroMemory(@Rows2,SizeOf(Rows2));
  ZeroMemory(@Rows3,SizeOf(Rows3));
  ZeroMemory(@Rows4,SizeOf(Rows4));
  ZeroMemory(@Rows5,SizeOf(Rows5));
  ZeroMemory(@Rows6,SizeOf(Rows6));
  ZeroMemory(@Rows7,SizeOf(Rows7));
  ZeroMemory(@Rows8,SizeOf(Rows8));
  ZeroMemory(@Rows41,SizeOf(Rows41));
  ZeroMemory(@RowsKZ,SizeOf(RowsKZ));
  ZeroMemory(@RowsFinal,SizeOf(RowsFinal));

  SetLength(Rows1,0,0);        SetLength(Cols1,0);
  SetLength(Rows2,0,0);        SetLength(Cols2,0);
  SetLength(Rows3,0,0);        SetLength(Cols3,0);
  SetLength(Rows4,0,0);        SetLength(Cols4,0);
  SetLength(Rows5,0,0);        SetLength(Cols5,0);
  SetLength(Rows6,0,0);        SetLength(Cols6,0);
  SetLength(Rows7,0,0);        SetLength(Cols7,0);
  SetLength(Rows8,0,0);        SetLength(Cols8,0);
  SetLength(Rows41,0,0);        SetLength(Cols41,0);
  SetLength(RowsKZ,0,0);        SetLength(ColsKZ,0);
  SetLength(RowsFinal,0,0);     SetLength(ColsFinal,0); }


end;
Ach ja: viele Teile doppeln sich, da sich die Datenmenge und damit Details der Anweisungen ändern. Ich fand es so einfacher, als es in andere Proceduren und Funktionen auszulagern...
Patrick

Geändert von Ykcim (19. Aug 2010 um 09:20 Uhr)
  Mit Zitat antworten Zitat