2016-05-06 6 views
0

Ich habe einen Excel-Export-Agent, der auf meinem alten 8.5-Server funktioniert. Wenn ich die Datenbank auf einen 9.0.1-Server verschoben habe, exportiert der Agent nur jeweils eine Zeile. Wenn in der Ansicht 30 Zeilen vorhanden sind, müssen Sie den Agenten 30 Mal ausführen. Was auf einem Domino unterscheidet 9, die den Agenten vom Laufen durch jede Zeile in der Ansicht stoppen würde? `Sub WriteViewasExcel (Darstellung als Notesview)Lotus Script Agent funktioniert nicht auf Domino 9 Server

%REM 
Agent ExporttoExcel 
Created Mar 11, 2010 by Brian Moore/usr/nbt 
Description: Comments for Agent 
%END REM 
Option Public 
Option Declare 

Sub Initialize() 
    Dim s As New NotesSession 
    Dim db As NotesDatabase 
    Dim qs As NotesView 
    Dim nv As NotesViewNavigator 
    Dim ne As NotesViewEntry 
    Dim Doc As NotesDocument  
    Set db = s.Currentdatabase 
    Set qs = db.GetView("Export") 
    Set nv = qs.CreateViewNav 
    Set ne = nv.GetFirst 
    Dim filename As String 

    Print |Content-Type:application/vnd.ms-excel| 
    filename="Excel "+db.Title+" "+Format(Now, "yyyy-mmm-d hhmm")+".xls" 'file name which will be suggested to user to save the resulting Excel file 
    Print |Content-Disposition: Attachment; filename="|+filename+|"| 'Triggers the save/open browser prompt instead of embedding the spreadsheet in the browser 
    Print "" 

    Print |<table border="1"><tr> 
     <td width="135"> <Center><b>Store Name</td></b> 
     <td width="80"> <Center><b>Date</td></b> 
     <td width="80"> <Center><b>Nontax clothing sales</td></b> 
     <td width="80"> <Center><b><font color="blue">Tax textile sales</td></b></font> 
     <td width="80"> <Center><b><font color="red">Furniture Sales</td></b></font> 
     <td width="80"> <Center><b><font color="green">Elec/Mech Appl/Fixture Sales</td></font> </b> 
     <td width="80"> <Center><b> Shoe Sales</td></b> 
     <td width="80"> <Center><b><font color="blue">Wares Sales</td></b></font> 
     <td width="80"> <Center><b><font color="red">Total Discounts</td></b></font> 
     <td width="80"> <Center><b><font color="green">Taxable Income</td></font> </b> 
     <td width="80"> <Center><b>Tax Amount</td></b> 
     <td width="80"> <Center><b><font color="blue">Credit Total</td></b></font> 
     <td width="80"> <Center><b><font color="red">Payout Total</td></b></font> 
     <td width="80"> <Center><b><font color="green">Actual Deposit</td></font> </b> 
     <td width="80"> <Center><b>MC/VISA Sales</td></b> 
     <td width="80"> <Center><b><font color="blue">AMEX Sales</td></b> 
     <td width="80"> <Center><b><font color="red">Gift Certificates</td></b> 
     <td width="80"> <Center><b>Customer Count</td></b> 
     <td width="80"> <Center><b>Total Donations</td></b></font></Center> 
     </tr>| 

    While Not(ne Is Nothing) 

     Set doc = ne.Document 
     Call doc.ReplaceItemValue("exported" , "yes") 
     Call doc.Save(True, False) 

     Print|<tr> <td>| + ne.ColumnValues(0) + |</td> | 'Store Name 
     Print|<td> | + ne.ColumnValues(1) + | </td> | 'Date 
     Print|<td> | + ne.ColumnValues(2) + | </td> | 'Non Tax Clothing Sales 
     Print|<td> <font color="blue">| + ne.ColumnValues(3) + | </font> </td> | 'Taxable Textile Sales 
     Print|<td> <font color="red">| + ne.ColumnValues(4) + | </font> </td> | 'Furniture Sales 
     Print|<td> <font color="green">| + ne.ColumnValues(5) + | </font> </td> | 'Elec/Mech Appliance/Fixture Sales 
     Print|<td> | + ne.ColumnValues(6) + | </td> | 'Shoe Sales 
     Print|<td> <font color="blue">| + ne.ColumnValues(7) + | </font> </td> | 'Wares Sales 
     Print|<td> <font color="red">| + ne.ColumnValues(8) + | </font> </td> | 'Total Discounts 
     Print|<td> <font color="green">| + ne.ColumnValues(9) + | </font> </td> | 'Taxable Income 
     Print|<td> | + ne.ColumnValues(10) + | </td> | 'Tax Amount 
     Print|<td> <font color="blue">| + ne.ColumnValues(11) + | </font> </td> | 'Credit Total 
     Print|<td> <font color="red">| + ne.ColumnValues(12) + | </font> </td> | 'Payout Total 
     Print|<td> <font color="green">| + ne.ColumnValues(13) + | </font> </td> | 'Actural Deposits 
     Print|<td> | + ne.ColumnValues(14) + | </td> | 'MC/VISA Sales 
     Print|<td> <font color="blue">| + ne.ColumnValues(15) + | </font> </td> | 'AMEX Sales 
     Print|<td> <font color="red">| + ne.ColumnValues(16) + | </font> </td> | 'Gift Certificates 
     Print|<td> <font color="red">| + ne.ColumnValues(17) + | </font> </td> | 'Customer Count 
     Print|<td> <font color="red">| + ne.ColumnValues(18) + | </font> </td> | 'Total Donations 

     Set ne = nv.GetNext(ne) 
    Wend 

End Sub 

Antwort

2

Fügen Sie nach dem Code Zeile

Set qs = db.GetView("Export") 

die Linie

qs.AutoUpdate = False 

Ihr Ansichtsnavigator wird verwirrt, wenn Dokumente aus der Ansicht gelöscht werden, während der Navigator versucht, von einem Eintrag zum nächsten zu gelangen. qs.AutoUpdate = False verhindert alle Einträge in der Ansicht während Agent ausgeführt wird.

+0

Danke Knut. Ich gebe das eine Chance. Aber warum funktionierte es auf einem älteren Server? Neugierig. –

+0

Arbeitete PERFEKT ..... Vielen Dank. –

+0

Wahrscheinlich ist es eine Verbesserung von Domino 9, den Ansichtsnavigator und die zugrunde liegende Ansicht während des Agentenlaufs aktualisieren zu können. Es ist nicht wirklich etwas, was Sie in Ihrem Fall brauchen ... –

Verwandte Themen