2012-04-10 11 views
1

Ich kann nicht scheinen, die Auflösung dafür zu finden. Ich habe die Fetch-Methode in einem Bericht geändert, sodass, wenn der queryRun geändert wird und die neue ID abgerufen wird, die while-Schleife erneut gestartet wird und eine neue Seite angezeigt wird und 2 Elemente ausgeführt werden. Dieser Teil funktioniert gut, der nächste Teil nicht, in jeder ID gibt es mehrere Datensätze, die ich benutze Element.Execute(); und element.Send(); herstellen. Was passiert ist, ist die erste ID ausgewählt, das Element (Körper) der Berichte wird ausgeführt und das Element wird wie erwartet gesendet, jedoch geht die While-Schleife nicht auf die nächste ID?X ++ Coming Out von QueryRun in Fetch Methode

Hier ist der Code;

public boolean fetch() 
{ 
    APMPriorityId   oldVanId, newVanId; 
    LogisticsControlTable lLogisticsControlTable; 
    int64     cnt, counter; 
    ; 

    queryRun = new QueryRun(this); 

    if (!queryRun.prompt() || !element.prompt()) 
    { 
     return false; 
    } 

    while (queryRun.next()) 
    { 
     if (queryRun.changed(tableNum(LogisticsControlTable))) 
     { 
      lLogisticsControlTable = queryRun.get(tableNum(LogisticsControlTable)); 
      if (lLogisticsControlTable) 
      { 
       info(lLogisticsControlTable.APMPriorityId); 
       cnt  = 0; 
       oldVanId = newVanId; 
       newVanId = lLogisticsControlTable.APMPriorityId; 

       if(newVanId) 
       { 
        element.newPage(); 
        element.execute(1); 
        element.execute(2); 
       } 
      } 

      if (lLogisticsControlTable.APMPriorityId) 

      select count(recId) from lLogisticsControlTable where lLogisticsControlTable.APMPriorityId == newVanId; 
      counter = lLogisticsControlTable.RecId; 

      while select lLogisticsControlTable where lLogisticsControlTable.APMPriorityId == newVanId 
      { 
       cnt++; 

       if(lLogisticsControlTable.APMPriorityId == newVanId && cnt <= counter) 
       { 
        element.execute(3); 
        element.send(lLogisticsControlTable); 
       } 
      } 
     } 
    } 
    return true; 
} 

Antwort

0

Sie verwenden lLogisticsControlTable als Ziel sowohl ein queryRun.get() und ein while select. Diese beiden Anwendungen stören jedoch; Es gibt zwei SQL-Cursor zum Steuern.

Verwenden Sie zwei verschiedene Datensatzvariablen.

+0

Jan, vielen Dank dafür. Ich habe eine zweite Variable hinzugefügt und das Problem wurde behoben. – will